305 # This option is added to CFLAGS rather than OPT_CFLAGS 306 # so that OPT_CFLAGS overrides get this option too. 307 CFLAGS += -fno-strict-aliasing 308 309 ifdef OPT_CFLAGS 310 ifneq ("$(origin OPT_CFLAGS)", "command line") 311 $(error " Use OPT_EXTRAS instead of OPT_CFLAGS to add extra flags to OPT_CFLAGS.") 312 endif 313 endif 314 315 OPT_CFLAGS = $(OPT_CFLAGS/$(OPT_CFLAGS_DEFAULT)) $(OPT_EXTRAS) 316 317 # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp 318 # if we use expensive-optimizations 319 ifeq ($(BUILDARCH), ia64) 320 OPT_CFLAGS += -fno-expensive-optimizations 321 endif 322 323 # Work around some compiler bugs. 324 ifeq ($(USE_CLANG), true) 325 # Clang < 6 | <= 6.1 | <= 7.0 326 ifeq ($(shell expr \ 327 $(CC_VER_MAJOR) \< 6 \| \ 328 \( $(CC_VER_MAJOR) = 6 \& $(CC_VER_MINOR) \<= 1 \) \| \ 329 \( $(CC_VER_MAJOR) = 7 \& $(CC_VER_MINOR) \<= 0 \) \ 330 ), 1) 331 OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT) 332 OPT_CFLAGS/unsafe.o += -O1 333 334 # The debug flag is added to OPT_CFLAGS, but lost in case of per-file overrides 335 # of OPT_CFLAGS. Restore it here. 336 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 337 OPT_CFLAGS/loopTransform.o += -g 338 OPT_CFLAGS/unsafe.o += -g 339 endif 340 else 341 $(error "Update compiler workarounds for Clang $(CC_VER_MAJOR).$(CC_VER_MINOR)") 342 endif 343 else 344 # Do not allow GCC 4.1.1 345 ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 1 \& $(CC_VER_MICRO) = 1), 1) 346 $(error "GCC $(CC_VER_MAJOR).$(CC_VER_MINOR).$(CC_VER_MICRO) not supported because of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=27724") 347 endif 348 # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation. 349 ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1) | 305 # This option is added to CFLAGS rather than OPT_CFLAGS 306 # so that OPT_CFLAGS overrides get this option too. 307 CFLAGS += -fno-strict-aliasing 308 309 ifdef OPT_CFLAGS 310 ifneq ("$(origin OPT_CFLAGS)", "command line") 311 $(error " Use OPT_EXTRAS instead of OPT_CFLAGS to add extra flags to OPT_CFLAGS.") 312 endif 313 endif 314 315 OPT_CFLAGS = $(OPT_CFLAGS/$(OPT_CFLAGS_DEFAULT)) $(OPT_EXTRAS) 316 317 # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp 318 # if we use expensive-optimizations 319 ifeq ($(BUILDARCH), ia64) 320 OPT_CFLAGS += -fno-expensive-optimizations 321 endif 322 323 # Work around some compiler bugs. 324 ifeq ($(USE_CLANG), true) 325 # Clang < 6 | <= 6.1 | <= 7.3 326 ifeq ($(shell expr \ 327 $(CC_VER_MAJOR) \< 6 \| \ 328 \( $(CC_VER_MAJOR) = 6 \& $(CC_VER_MINOR) \<= 1 \) \| \ 329 \( $(CC_VER_MAJOR) = 7 \& $(CC_VER_MINOR) \<= 3 \) \ 330 ), 1) 331 OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT) 332 OPT_CFLAGS/unsafe.o += -O1 333 334 # The debug flag is added to OPT_CFLAGS, but lost in case of per-file overrides 335 # of OPT_CFLAGS. Restore it here. 336 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 337 OPT_CFLAGS/loopTransform.o += -g 338 OPT_CFLAGS/unsafe.o += -g 339 endif 340 else 341 $(error "Update compiler workarounds for Clang $(CC_VER_MAJOR).$(CC_VER_MINOR)") 342 endif 343 else 344 # Do not allow GCC 4.1.1 345 ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 1 \& $(CC_VER_MICRO) = 1), 1) 346 $(error "GCC $(CC_VER_MAJOR).$(CC_VER_MINOR).$(CC_VER_MICRO) not supported because of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=27724") 347 endif 348 # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation. 349 ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1) |