From 013dbcd6111bc880e65ed00a7ca31e19230a81d5 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Wed, 31 Oct 2007 09:47:39 -0700 Subject: Add -fno-strict-aliasing workaround for Linux GCC targets Most Linux distros work around aliasing problems in Mesa by compiling with the GCC option -fno-strict-aliasing. Two examples: https://bugs.freedesktop.org/show_bug.cgi?id=6046 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=394311 This makes -fno-strict-aliasing the default with a comment that developers should consider commenting it out. There is a already a note about these bugs in docs/helpwanted.html. --- configs/linux | 4 ++++ configs/linux-alpha | 4 ++++ configs/linux-alpha-static | 3 +++ configs/linux-directfb | 4 ++++ configs/linux-dri | 3 +++ configs/linux-dri-xcb | 3 +++ configs/linux-fbdev | 3 +++ configs/linux-glide | 3 +++ configs/linux-indirect | 3 +++ configs/linux-osmesa | 3 +++ configs/linux-osmesa16 | 3 +++ configs/linux-osmesa16-static | 3 +++ configs/linux-osmesa32 | 3 +++ configs/linux-solo | 3 +++ configs/linux-x86-glide | 3 +++ 15 files changed, 48 insertions(+) (limited to 'configs') diff --git a/configs/linux b/configs/linux index 0d455ff46a..15700a1a3b 100644 --- a/configs/linux +++ b/configs/linux @@ -28,6 +28,10 @@ CFLAGS = -Wall -Wmissing-prototypes $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) \ CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \ $(X11_INCLUDES) +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + GLUT_CFLAGS = -fexceptions EXTRA_LIB_PATH = -L/usr/X11R6/lib diff --git a/configs/linux-alpha b/configs/linux-alpha index d69aabb730..65bf0c2ab6 100644 --- a/configs/linux-alpha +++ b/configs/linux-alpha @@ -11,6 +11,10 @@ CFLAGS = -O3 -mcpu=ev5 -ansi -mieee -pedantic -fPIC -D_XOPEN_SOURCE -DUSE_XSHM CXXFLAGS = -O3 -mcpu=ev5 -ansi -mieee -pedantic -fPIC -D_XOPEN_SOURCE 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/X11R6/lib -lX11 -lXext -lm -lpthread GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L/usr/X11R6/lib -lXt -lX11 diff --git a/configs/linux-alpha-static b/configs/linux-alpha-static index 2a30af9b68..08ec2d177e 100644 --- a/configs/linux-alpha-static +++ b/configs/linux-alpha-static @@ -12,6 +12,9 @@ CXXFLAGS = -O3 -mcpu=ev5 -ansi -mieee -pedantic -D_XOPEN_SOURCE GLUT_CFLAGS = -fexceptions 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 diff --git a/configs/linux-directfb b/configs/linux-directfb index 09332f4808..2a9843e93c 100644 --- a/configs/linux-directfb +++ b/configs/linux-directfb @@ -13,6 +13,10 @@ CFLAGS = -Wall -O3 -ffast-math -fPIC -std=c99 -D_GNU_SOURCE -D_POSIX_SOURCE -D CXXFLAGS = -Wall -O3 -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + HAVE_X86 = $(shell uname -m | grep 'i[3-6]86' >/dev/null && echo yes) ifeq ($(HAVE_X86), yes) CFLAGS += -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM diff --git a/configs/linux-dri b/configs/linux-dri index 2369f75b07..a9ff7e9678 100644 --- a/configs/linux-dri +++ b/configs/linux-dri @@ -32,6 +32,9 @@ CFLAGS = -Wall -Wmissing-prototypes -std=c99 -ffast-math \ CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing ASM_SOURCES = diff --git a/configs/linux-dri-xcb b/configs/linux-dri-xcb index 1f233f07f5..69643718ad 100644 --- a/configs/linux-dri-xcb +++ b/configs/linux-dri-xcb @@ -32,6 +32,9 @@ CFLAGS = -Wall -Wmissing-prototypes $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) \ CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing ASM_SOURCES = diff --git a/configs/linux-fbdev b/configs/linux-fbdev index e36d20a702..69d10127c8 100644 --- a/configs/linux-fbdev +++ b/configs/linux-fbdev @@ -6,6 +6,9 @@ CONFIG_NAME = linux-fbdev CFLAGS = -O3 -ffast-math -ansi -pedantic -fPIC -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS -DUSE_GLFBDEV_DRIVER +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing + SRC_DIRS = mesa glu glut/fbdev DRIVER_DIRS = fbdev osmesa PROGRAM_DIRS = fbdev demos redbook samples diff --git a/configs/linux-glide b/configs/linux-glide index 0a40521e1b..31475c81d8 100644 --- a/configs/linux-glide +++ b/configs/linux-glide @@ -12,6 +12,9 @@ CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE GLUT_CFLAGS = -fexceptions +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing # Library/program dependencies GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -L/usr/local/glide/lib -lglide3x -lm -lpthread diff --git a/configs/linux-indirect b/configs/linux-indirect index bd33345ed7..17c7126e11 100644 --- a/configs/linux-indirect +++ b/configs/linux-indirect @@ -33,6 +33,9 @@ CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \ CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing ASM_SOURCES = diff --git a/configs/linux-osmesa b/configs/linux-osmesa index cc1fbbd109..163b145291 100644 --- a/configs/linux-osmesa +++ b/configs/linux-osmesa @@ -12,6 +12,9 @@ CXX = g++ CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing # Directories SRC_DIRS = mesa glu diff --git a/configs/linux-osmesa16 b/configs/linux-osmesa16 index 1fb0186d31..796fba1780 100644 --- a/configs/linux-osmesa16 +++ b/configs/linux-osmesa16 @@ -10,6 +10,9 @@ CXX = g++ CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include -DCHAN_BITS=16 -DDEFAULT_SOFTWARE_DEPTH_BITS=31 CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing # Library names OSMESA_LIB = OSMesa16 diff --git a/configs/linux-osmesa16-static b/configs/linux-osmesa16-static index 6645504478..22f6851d32 100644 --- a/configs/linux-osmesa16-static +++ b/configs/linux-osmesa16-static @@ -11,6 +11,9 @@ CFLAGS = -O3 -ansi -pedantic -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=19930 CXXFLAGS = -O3 -ansi -pedantic -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE MKLIB_OPTIONS = -static +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing # Library names OSMESA_LIB = OSMesa16 diff --git a/configs/linux-osmesa32 b/configs/linux-osmesa32 index a1e5a358d6..12d0cb053d 100644 --- a/configs/linux-osmesa32 +++ b/configs/linux-osmesa32 @@ -10,6 +10,9 @@ CXX = g++ CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include -DCHAN_BITS=32 -DDEFAULT_SOFTWARE_DEPTH_BITS=31 CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing # Library names OSMESA_LIB = OSMesa32 diff --git a/configs/linux-solo b/configs/linux-solo index 2d0817dfb7..e01f2c8a39 100644 --- a/configs/linux-solo +++ b/configs/linux-solo @@ -32,6 +32,9 @@ CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \ CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing ASM_SOURCES = diff --git a/configs/linux-x86-glide b/configs/linux-x86-glide index f2f8aeea60..941efc1e59 100644 --- a/configs/linux-x86-glide +++ b/configs/linux-x86-glide @@ -14,6 +14,9 @@ CXXFLAGS = -Wall -O3 -ansi -pedantic -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199 GLUT_CFLAGS = -fexceptions +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing ASM_SOURCES = $(X86_SOURCES) ASM_API = $(X86_API) -- cgit v1.2.3