When gallium llvm is enabled, configure.ac does the following :
LLVM_CFLAGS=`$LLVM_CONFIG --cflags`

This is the result on my system :
-I/usr/include  -DNDEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
-D__STDC_CONSTANT_MACROS -O2 -fomit-frame-pointer -fPIC

I specifically set -O0 to easier gdb debugging and
-fno-omit-frame-pointer to use some profiling tools, but they were
both silently overridden by llvm cflags.

Also scons/llvm.py only uses cppflags, not cflags, which at least
gives a better result
 llvm-config --cppflags : -I/usr/include  -DNDEBUG -D_GNU_SOURCE
-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS

then src/gallium/Makefile.template has :
ifeq ($(MESA_LLVM),1)
LIBRARY_DEFINES += $(LLVM_CFLAGS)
endif

Do we want / need these definitions for all the code in src/gallium,
or is it possible to add them only in the parts that do use llvm and
need the definitions from llvm-config --cppflags ?

I found it weird that enabling or disabling gallium llvm resulted in
nv50 gallium built with different gcc flags.
From df82cdf0b9b6bd60ef47ddbf4b6d74d200382262 Mon Sep 17 00:00:00 2001
From: Xavier Chantry <chantry.xav...@gmail.com>
Date: Fri, 24 Sep 2010 13:17:40 +0200
Subject: [PATCH] configure.ac : use llvm-config cppflags instead of cflags

llvm cflags are too intrusive and override user-defined flags. cppflags
are probably enough and this is what scons/llvm.py uses already.

$ llvm-config --cflags
-I/usr/include  -DNDEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
-D__STDC_CONSTANT_MACROS -O2 -fomit-frame-pointer -fPIC

$ llvm-config --cppflags
-I/usr/include  -DNDEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
-D__STDC_CONSTANT_MACROS
---
 configure.ac |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2b8296d..c88ee5e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1439,7 +1439,7 @@ AC_ARG_ENABLE([gallium-llvm],
 if test "x$enable_gallium_llvm" = xyes; then
     if test "x$LLVM_CONFIG" != xno; then
 	LLVM_VERSION=`$LLVM_CONFIG --version`
-	LLVM_CFLAGS=`$LLVM_CONFIG --cflags`
+	LLVM_CFLAGS=`$LLVM_CONFIG --cppflags`
 	LLVM_LIBS="`$LLVM_CONFIG --libs jit interpreter nativecodegen bitwriter` -lstdc++"
 
 	if test "x$HAS_UDIS86" != xno; then
-- 
1.7.3

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to