From db3bf1eeb3182dc4ac80352f72a2ebd9d59d6e53 Mon Sep 17 00:00:00 2001 From: Peter Bain Date: Mon, 12 Nov 2018 09:43:46 -0500 Subject: [PATCH] WIP Add -fno-strict-aliasing to compiler options Add this option to ARM, PPC linux, and X86 linux. Update bot makefiles and cmakefiles. Remove the option from the GC project. This is related to Issue https://github.com/eclipse/openj9/issues/2872 Signed-off-by: Peter Bain --- cmake/modules/platform/toolcfg/gnu.cmake | 2 +- gc/CMakeLists.txt | 2 +- omrmakefiles/rules.linux.mk | 10 +++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/cmake/modules/platform/toolcfg/gnu.cmake b/cmake/modules/platform/toolcfg/gnu.cmake index 389b48b009b..bde7019cd01 100644 --- a/cmake/modules/platform/toolcfg/gnu.cmake +++ b/cmake/modules/platform/toolcfg/gnu.cmake @@ -23,7 +23,7 @@ set(OMR_WARNING_AS_ERROR_FLAG -Werror) set(OMR_ENHANCED_WARNING_FLAG -Wall) -list(APPEND OMR_PLATFORM_COMPILE_OPTIONS -pthread) +list(APPEND OMR_PLATFORM_COMPILE_OPTIONS -pthread -fno-strict-aliasing) if(OMR_ENV_DATA64) if (NOT (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")) diff --git a/gc/CMakeLists.txt b/gc/CMakeLists.txt index 2d370f7068d..5fc6a71917c 100644 --- a/gc/CMakeLists.txt +++ b/gc/CMakeLists.txt @@ -323,7 +323,7 @@ if(OMR_ENHANCED_WARNINGS) endif() if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang") - target_compile_options(omrgc PRIVATE -fno-strict-aliasing) + target_compile_options(omrgc PRIVATE) elseif(CMAKE_CXX_COMPILER_ID MATCHES "XL|VisualAge") target_compile_options(omrgc PRIVATE -qalias=noansi) endif() diff --git a/omrmakefiles/rules.linux.mk b/omrmakefiles/rules.linux.mk index 8568ffe7815..00ecd4a56f3 100644 --- a/omrmakefiles/rules.linux.mk +++ b/omrmakefiles/rules.linux.mk @@ -187,21 +187,25 @@ ifeq (x86,$(OMR_HOST_ARCH)) GLOBAL_CXXFLAGS+=-m32 -msse2 -I/usr/include/nptl GLOBAL_CPPFLAGS+=-DJ9X86 endif + GLOBAL_CFLAGS+=-fno-strict-aliasing + GLOBAL_CXXFLAGS+=-fno-strict-aliasing else ifeq (aarch64,$(OMR_HOST_ARCH)) - GLOBAL_CFLAGS+=-march=armv8-a+simd -Wno-unused-but-set-variable - GLOBAL_CXXFLAGS+=-march=armv8-a+simd -Wno-unused-but-set-variable + GLOBAL_CFLAGS+=-march=armv8-a+simd -Wno-unused-but-set-variable -fno-strict-aliasing + GLOBAL_CXXFLAGS+=-march=armv8-a+simd -Wno-unused-but-set-variable -fno-strict-aliasing GLOBAL_CPPFLAGS+=-DJ9AARCH64 -DAARCH64GNU -DAARCH64 -DFIXUP_UNALIGNED -Wno-unused-but-set-variable else ifeq (arm,$(OMR_HOST_ARCH)) - GLOBAL_CFLAGS+=$(ARM_ARCH_FLAGS) -Wno-unused-but-set-variable + GLOBAL_CFLAGS+=$(ARM_ARCH_FLAGS) -Wno-unused-but-set-variable -fno-strict-aliasing GLOBAL_CPPFLAGS+=-DJ9ARM -DARMGNU -DARM -DFIXUP_UNALIGNED $(ARM_ARCH_FLAGS) -Wno-unused-but-set-variable else ifeq (ppc,$(OMR_HOST_ARCH)) GLOBAL_CPPFLAGS+=-DLINUXPPC ifeq (gcc,$(OMR_TOOLCHAIN)) + GLOBAL_CFLAGS+=-fno-strict-aliasing + GLOBAL_CXXFLAGS+=-fno-strict-aliasing ifeq (1,$(OMR_ENV_DATA64)) GLOBAL_CFLAGS+=-m64 GLOBAL_CXXFLAGS+=-m64