From: Dan Nicholson Date: Wed, 31 Oct 2007 16:47:39 +0000 (-0700) Subject: Add -fno-strict-aliasing workaround for Linux GCC targets X-Git-Tag: mesa-7.8~5881^2~92 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=013dbcd6111bc880e65ed00a7ca31e19230a81d5;p=platform%2Fupstream%2Fmesa.git 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. --- diff --git a/configs/linux b/configs/linux index 0d455ff..15700a1 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 d69aabb..65bf0c2 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 2a30af9..08ec2d1 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 09332f4..2a9843e 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 2369f75..a9ff7e9 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 1f233f0..6964371 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 e36d20a..69d1012 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 0a40521..31475c8 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 bd33345..17c7126 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 cc1fbbd..163b145 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 1fb0186..796fba1 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 6645504..22f6851 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 a1e5a35..12d0cb0 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 2d0817d..e01f2c8 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 f2f8aee..941efc1 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)