133
134 # position-independent code
135 PICFLAG = -fPIC
136
137 VM_PICFLAG/LIBJVM = $(PICFLAG)
138 VM_PICFLAG/AOUT =
139 VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO))
140
141 ifeq ($(JVM_VARIANT_ZERO), true)
142 CFLAGS += $(LIBFFI_CFLAGS)
143 endif
144 ifeq ($(JVM_VARIANT_ZEROSHARK), true)
145 CFLAGS += $(LIBFFI_CFLAGS)
146 CFLAGS += $(LLVM_CFLAGS)
147 endif
148 CFLAGS += $(VM_PICFLAG)
149 CFLAGS += -fno-rtti
150 CFLAGS += -fno-exceptions
151 CFLAGS += -D_REENTRANT
152 ifeq ($(USE_CLANG),)
153 CFLAGS += -fcheck-new
154 # version 4 and above support fvisibility=hidden (matches jni_x86.h file)
155 # except 4.1.2 gives pointless warnings that can't be disabled (afaik)
156 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
157 CFLAGS += -fvisibility=hidden
158 endif
159 else
160 CFLAGS += -fvisibility=hidden
161 endif
162
163 ifeq ($(USE_CLANG), true)
164 # Before Clang 3.1, we had to pass the stack alignment specification directly to llvm with the help of '-mllvm'
165 # Starting with version 3.1, Clang understands the '-mstack-alignment' (and rejects '-mllvm -stack-alignment')
166 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 1 \) \))" "0"
167 STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mstack-alignment=16
168 else
169 STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mllvm -stack-alignment=16
170 endif
171 endif
172
173 ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
259
260 # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp
261 # if we use expensive-optimizations
262 ifeq ($(BUILDARCH), ia64)
263 OPT_CFLAGS += -fno-expensive-optimizations
264 endif
265
266 OPT_CFLAGS/NOOPT=-O0
267
268 # Work around some compiler bugs.
269 ifeq ($(USE_CLANG), true)
270 ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1)
271 OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT)
272 endif
273 else
274 # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation.
275 ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1)
276 OPT_CFLAGS/mulnode.o += $(OPT_CFLAGS/NOOPT)
277 endif
278 endif
279
280 # Flags for generating make dependency flags.
281 DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
282 ifeq ($(USE_CLANG),)
283 ifneq ("${CC_VER_MAJOR}", "2")
284 DEPFLAGS += -fpch-deps
285 endif
286 endif
287
288 #------------------------------------------------------------------------
289 # Linker flags
290
291 # statically link libstdc++.so, work with gcc but ignored by g++
292 STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
293 # While the VM needs the above line, adlc needs a separate setting:
294 ADLC_STATIC_STDCXX = -static-libstdc++
295
296 ifeq ($(USE_CLANG),)
297 # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
298 ifneq ("${CC_VER_MAJOR}", "2")
|
133
134 # position-independent code
135 PICFLAG = -fPIC
136
137 VM_PICFLAG/LIBJVM = $(PICFLAG)
138 VM_PICFLAG/AOUT =
139 VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO))
140
141 ifeq ($(JVM_VARIANT_ZERO), true)
142 CFLAGS += $(LIBFFI_CFLAGS)
143 endif
144 ifeq ($(JVM_VARIANT_ZEROSHARK), true)
145 CFLAGS += $(LIBFFI_CFLAGS)
146 CFLAGS += $(LLVM_CFLAGS)
147 endif
148 CFLAGS += $(VM_PICFLAG)
149 CFLAGS += -fno-rtti
150 CFLAGS += -fno-exceptions
151 CFLAGS += -D_REENTRANT
152 ifeq ($(USE_CLANG),)
153 CFLAGS += -fcheck-new -fstack-protector
154 # version 4 and above support fvisibility=hidden (matches jni_x86.h file)
155 # except 4.1.2 gives pointless warnings that can't be disabled (afaik)
156 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
157 CFLAGS += -fvisibility=hidden
158 endif
159 else
160 CFLAGS += -fvisibility=hidden
161 endif
162
163 ifeq ($(USE_CLANG), true)
164 # Before Clang 3.1, we had to pass the stack alignment specification directly to llvm with the help of '-mllvm'
165 # Starting with version 3.1, Clang understands the '-mstack-alignment' (and rejects '-mllvm -stack-alignment')
166 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 1 \) \))" "0"
167 STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mstack-alignment=16
168 else
169 STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mllvm -stack-alignment=16
170 endif
171 endif
172
173 ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
259
260 # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp
261 # if we use expensive-optimizations
262 ifeq ($(BUILDARCH), ia64)
263 OPT_CFLAGS += -fno-expensive-optimizations
264 endif
265
266 OPT_CFLAGS/NOOPT=-O0
267
268 # Work around some compiler bugs.
269 ifeq ($(USE_CLANG), true)
270 ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1)
271 OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT)
272 endif
273 else
274 # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation.
275 ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1)
276 OPT_CFLAGS/mulnode.o += $(OPT_CFLAGS/NOOPT)
277 endif
278 endif
279
280 # Need extra inlining to collapse all the templated closures into the hot loop
281 OPT_CFLAGS/shenandoahConcurrentMark.o += $(OPT_CFLAGS) --param inline-unit-growth=1000
282
283 # Flags for generating make dependency flags.
284 DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
285 ifeq ($(USE_CLANG),)
286 ifneq ("${CC_VER_MAJOR}", "2")
287 DEPFLAGS += -fpch-deps
288 endif
289 endif
290
291 #------------------------------------------------------------------------
292 # Linker flags
293
294 # statically link libstdc++.so, work with gcc but ignored by g++
295 STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
296 # While the VM needs the above line, adlc needs a separate setting:
297 ADLC_STATIC_STDCXX = -static-libstdc++
298
299 ifeq ($(USE_CLANG),)
300 # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
301 ifneq ("${CC_VER_MAJOR}", "2")
|