# HG changeset patch # User andrew # Date 1467939525 -3600 # Node ID 59828109820c5d37018f92b79b94f7f464b7a0e4 # Parent 7561dfbeeee5a7eec9f940705cd15031e34b4601 8151841: Build needs additional flags to compile with GCC 6 Summary: C++ standard needs to be explicitly set and some optimisations turned off to build on GCC 6 Reviewed-by: erikj, dholmes, kbarrett diff -r 7561dfbeeee5 -r 59828109820c make/linux/makefiles/gcc.make --- a/make/linux/makefiles/gcc.make Wed May 04 23:23:54 2016 +0100 +++ b/make/linux/makefiles/gcc.make Fri Jul 08 01:58:45 2016 +0100 @@ -73,6 +73,7 @@ ifeq ($(SHARK_BUILD), true) CFLAGS += $(LLVM_CFLAGS) endif +CFLAGS += -std=gnu++98 CFLAGS += $(VM_PICFLAG) CFLAGS += -fno-rtti CFLAGS += -fno-exceptions @@ -83,6 +84,12 @@ ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" CFLAGS += -fvisibility=hidden endif +# GCC 6 has more aggressive dead-store elimination which causes the VM to crash +# It also optimises away null pointer checks which are still needed. +# We turn both of these optimisations off. +ifneq "$(shell expr \( $(CC_VER_MAJOR) \>= 6 \))" "0" +CFLAGS += -fno-delete-null-pointer-checks -fno-lifetime-dse +endif ARCHFLAG = $(ARCHFLAG/$(BUILDARCH)) ARCHFLAG/i486 = -m32 -march=i586