scons: Use -Bsymbolic linker option.
authorJosé Fonseca <jfonseca@vmware.com>
Sun, 28 Jun 2009 09:54:23 +0000 (10:54 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Sun, 28 Jun 2009 09:54:23 +0000 (10:54 +0100)
This prevents the error

  relocation R_X86_64_PC32 against symbol `_gl_DispatchTSD' can not be used when making a shared object; recompile with -fPIC

when building on x86_64 architecture.

scons/gallium.py

index ee45af50c2972b4c4ffa3af11505b77f6c85a8a1..b69f2f2a75aa64f3439ac3c7cc2ecaca34085dd4 100644 (file)
@@ -448,11 +448,15 @@ def generate(env):
 
     # Linker options
     linkflags = []
+    shlinkflags = []
     if gcc:
         if env['machine'] == 'x86':
             linkflags += ['-m32']
         if env['machine'] == 'x86_64':
             linkflags += ['-m64']
+        shlinkflags += [
+            '-Wl,-Bsymbolic',
+        ]
     if platform == 'windows' and msvc:
         # See also:
         # - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx
@@ -500,6 +504,7 @@ def generate(env):
             '/entry:_DllMainCRTStartup',
         ]
     env.Append(LINKFLAGS = linkflags)
+    env.Append(SHLINKFLAGS = shlinkflags)
 
     # Default libs
     env.Append(LIBS = [])