From 01b18abf93c1999397563e75fe1bfbbe0e080ae9 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Thu, 1 Nov 2007 06:01:53 -0700 Subject: [PATCH] Add -fno-strict-aliasing workaround for all GCC targets Use a GCC option to work around aliasing bugs. See commit 013dbcd for more details. --- configs/aix-gcc | 4 ++++ configs/beos | 4 ++++ configs/bluegene-osmesa | 4 ++++ configs/darwin | 4 ++++ configs/darwin-static | 4 ++++ configs/darwin-static-x86ppc | 4 ++++ configs/darwin-x86ppc | 4 ++++ configs/freebsd | 4 ++++ configs/freebsd-dri | 4 ++++ configs/hpux10-gcc | 4 ++++ configs/netbsd | 3 +++ configs/openbsd | 4 ++++ configs/solaris-x86-gcc | 4 ++++ configs/solaris-x86-gcc-static | 4 ++++ configs/sunos4-gcc | 4 ++++ configs/sunos5-gcc | 4 ++++ configs/sunos5-v9-cc-g++ | 3 +++ configs/ultrix-gcc | 4 ++++ 18 files changed, 70 insertions(+) diff --git a/configs/aix-gcc b/configs/aix-gcc index 81467082a73..3b964f351f7 100644 --- a/configs/aix-gcc +++ b/configs/aix-gcc @@ -11,6 +11,10 @@ CXX = g++ CFLAGS = -O2 -DAIXV3 CXXFLAGS = -O2 -DAIXV3 +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + MKLIB_OPTIONS = -arch aix-gcc GL_LIB_DEPS = -lX11 -lXext -lm GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm diff --git a/configs/beos b/configs/beos index f07973d0c78..9974b7b2201 100644 --- a/configs/beos +++ b/configs/beos @@ -39,6 +39,10 @@ ifeq ($(CPU), x86) CXXFLAGS = $(CFLAGS) + # Work around aliasing bugs - developers should comment this out + CFLAGS += -fno-strict-aliasing + CXXFLAGS += -fno-strict-aliasing + LDFLAGS += -Xlinker ifdef DEBUG diff --git a/configs/bluegene-osmesa b/configs/bluegene-osmesa index 02c69e6c67e..d22454fa2d9 100644 --- a/configs/bluegene-osmesa +++ b/configs/bluegene-osmesa @@ -13,6 +13,10 @@ CXX = /bgl/BlueLight/ppcfloor/blrts-gnu/bin/powerpc-bgl-blrts-gnu-g++ CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURC +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + MKLIB_OPTIONS = -static OSMESA_LIB_NAME = libOSMesa.a diff --git a/configs/darwin b/configs/darwin index 7826ecc605e..76f3f74d4e6 100644 --- a/configs/darwin +++ b/configs/darwin @@ -10,6 +10,10 @@ CXX = cc CFLAGS = -I/usr/X11R6/include -O3 -fPIC -fno-common -ffast-math -funroll-loops -fexpensive-optimizations -no-cpp-precomp -dynamic -Ddarwin CXXFLAGS = -I/usr/X11R6/include -O3 -fPIC -fno-common -ffast-math -funroll-loops -fexpensive-optimizations -no-cpp-precomp -dynamic -Ddarwin +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + # Library names (actual file names) GL_LIB_NAME = libGL.dylib GLU_LIB_NAME = libGLU.dylib diff --git a/configs/darwin-static b/configs/darwin-static index 3eb6581fb02..9893d159bd2 100644 --- a/configs/darwin-static +++ b/configs/darwin-static @@ -9,6 +9,10 @@ CFLAGS = -I/usr/X11R6/include -O3 -fno-common -ffast-math -funroll-loops -fexpen CXXFLAGS = -I/usr/X11R6/include -O3 -fno-common -ffast-math -funroll-loops -fexpensive-optimizations -no-cpp-precomp -dynamic -Ddarwin MKLIB_OPTIONS = -static +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + # Library names (actual file names) GL_LIB_NAME = libGL.a GLU_LIB_NAME = libGLU.a diff --git a/configs/darwin-static-x86ppc b/configs/darwin-static-x86ppc index 844a1d2eade..7e97474dfe0 100644 --- a/configs/darwin-static-x86ppc +++ b/configs/darwin-static-x86ppc @@ -11,6 +11,10 @@ CXXFLAGS = -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk \ -I/usr/X11R6/include -O3 -fno-common -ffast-math -funroll-loops -fexpensive-optimizations -no-cpp-precomp -dynamic -Ddarwin MKLIB_OPTIONS = -static -archopt "-isysroot /Developer/SDKs/MacOSX10.4u.sdk" +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + # Library names (actual file names) GL_LIB_NAME = libGL.a GLU_LIB_NAME = libGLU.a diff --git a/configs/darwin-x86ppc b/configs/darwin-x86ppc index 13172327a76..c87b206f926 100644 --- a/configs/darwin-x86ppc +++ b/configs/darwin-x86ppc @@ -14,6 +14,10 @@ CXXFLAGS = -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk \ MKLIB_OPTIONS = -archopt "-isysroot /Developer/SDKs/MacOSX10.4u.sdk" +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + # Library names (actual file names) GL_LIB_NAME = libGL.dylib GLU_LIB_NAME = libGLU.dylib diff --git a/configs/freebsd b/configs/freebsd index 34440eb3239..976ddd19e6f 100644 --- a/configs/freebsd +++ b/configs/freebsd @@ -23,5 +23,9 @@ CXXFLAGS += $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(DEFINES) $(X11_INCLUDES) GLUT_CFLAGS = -fexceptions +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + EXTRA_LIB_PATH = -L/usr/local/lib APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) $(EXTRA_LIB_PATH) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lXext -lXmu -lXi -lX11 -lm diff --git a/configs/freebsd-dri b/configs/freebsd-dri index 0f52b9149b1..9d9215483d9 100644 --- a/configs/freebsd-dri +++ b/configs/freebsd-dri @@ -22,6 +22,10 @@ CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) -Wmissing-prototypes -std=c99 - CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(DEFINES) -Wall -ansi -pedantic $(ASM_FLAGS) $(X11_INCLUDES) +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + ASM_SOURCES = # Library/program dependencies diff --git a/configs/hpux10-gcc b/configs/hpux10-gcc index 10a9ad5cd57..be396f85499 100644 --- a/configs/hpux10-gcc +++ b/configs/hpux10-gcc @@ -12,5 +12,9 @@ CFLAGS = -ansi -O3 -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/incl CXXFLAGS = -ansi -O3 -D_HPUX_SOURCE GLUT_CFLAGS = -fexceptions +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/lib/X11R6 -L/usr/contrib/X11R6/lib -lXext -lXmu -lXi -lX11 -lm diff --git a/configs/netbsd b/configs/netbsd index f5a61a89570..aec45695071 100644 --- a/configs/netbsd +++ b/configs/netbsd @@ -12,3 +12,6 @@ CXXFLAGS = -O2 -fPIC GLUT_CFLAGS = -fexceptions APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/X11R6/lib -lXext -lXmu -lXi -lX11 -lm +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing diff --git a/configs/openbsd b/configs/openbsd index 6ad6e2bd3d0..bd19fa84d39 100644 --- a/configs/openbsd +++ b/configs/openbsd @@ -10,6 +10,10 @@ CXX = g++ CFLAGS = -O2 -fPIC -I/usr/X11R6/include -DUSE_XSHM -DHZ=100 CXXFLAGS = -O2 -fPIC -I/usr/X11R6/include -DHZ=100 +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm OSMESA_LIB_DEPS = -lm GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) diff --git a/configs/solaris-x86-gcc b/configs/solaris-x86-gcc index 5ec7237f991..616bfdfd778 100644 --- a/configs/solaris-x86-gcc +++ b/configs/solaris-x86-gcc @@ -11,6 +11,10 @@ CFLAGS = -O3 -march=i486 -fPIC -I/usr/openwin/include -DUSE_XSHM CXXFLAGS = -O3 -march=i486 -fPIC GLUT_CFLAGS = -fexceptions +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + GL_LIB_DEPS = -L/usr/openwin/lib -lX11 -lXext -lm -lpthread GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/openwin/lib -lX11 -lXmu -lXt -lXi -lm diff --git a/configs/solaris-x86-gcc-static b/configs/solaris-x86-gcc-static index be02735f028..4850284a59f 100644 --- a/configs/solaris-x86-gcc-static +++ b/configs/solaris-x86-gcc-static @@ -12,6 +12,10 @@ CXXFLAGS = -O3 -march=i486 -fPIC GLUT_CFLAGS = -fexceptions MKLIB_OPTIONS = -static +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + GL_LIB_DEPS = -L/usr/openwin/lib -lX11 -lXext -lm -lpthread GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/openwin/lib -lX11 -lXmu -lXt -lXi -lm diff --git a/configs/sunos4-gcc b/configs/sunos4-gcc index 2022dd7e8e7..09422915894 100644 --- a/configs/sunos4-gcc +++ b/configs/sunos4-gcc @@ -11,5 +11,9 @@ CFLAGS = -fPIC -O3 -I/usr/openwin/include -I/usr/include/X11R5 -I/usr/include/X1 CXXFLAGS = -fPIC -O3 -I/usr/openwin/include -DSUNOS4 GLUT_CFLAGS = -fexceptions -DSOLARIS_2_4_BUG +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lm diff --git a/configs/sunos5-gcc b/configs/sunos5-gcc index 77b293c5452..c5e443fc75e 100644 --- a/configs/sunos5-gcc +++ b/configs/sunos5-gcc @@ -28,6 +28,10 @@ CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \ GLUT_CFLAGS = -fexceptions -DSOLARIS_2_4_BUG +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + # Library/program dependencies EXTRA_LIB_PATH=-L/usr/openwin/lib diff --git a/configs/sunos5-v9-cc-g++ b/configs/sunos5-v9-cc-g++ index 37b775cc08e..8656251e3b7 100644 --- a/configs/sunos5-v9-cc-g++ +++ b/configs/sunos5-v9-cc-g++ @@ -21,6 +21,9 @@ CXX_ARCH_FLAGS = -m64 CXXFLAGS = $(CXX_WARN_FLAGS) $(CXX_OPT_FLAGS) $(CXX_PIC_FLAGS) $(CXX_ARCH_FLAGS) $(DEFINES) \ -I/usr/openwin/include +# Work around aliasing bugs - developers should comment this out +CXXFLAGS += -fno-strict-aliasing + CFLAGS = -xarch=v9 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM -DPTHREADS #CXXFLAGS = -xarch=v9 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DPTHREADS GLUT_CFLAGS = -DSOLARIS_2_4_BUG diff --git a/configs/ultrix-gcc b/configs/ultrix-gcc index 5c0f22d7ae7..455b6932d37 100644 --- a/configs/ultrix-gcc +++ b/configs/ultrix-gcc @@ -12,6 +12,10 @@ CXXFLAGS = -pedantic -O2 GLUT_CFLAGS = -fexceptions MKLIB_OPTIONS = -static +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + GL_LIB_NAME = libGL.a GLU_LIB_NAME = libGLU.a GLUT_LIB_NAME = libglut.a -- 2.30.2