[x264-devel] [PATCH] Fix linker test for -Bsymbolic

Sean McGovern gseanmcg at gmail.com
Wed Apr 20 02:57:42 CEST 2011


the Solaris linker only accepts -Bsymbolic for objects compiled
in dynamic mode (ie. shared objects), so pass -shared to gcc.

Additionally, for x86_32 unresolved textrels cause a linker error
so mark the .text section as 'impure'.
---
 Makefile  |    2 +-
 configure |    5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 67301fc..7ed0b61 100644
--- a/Makefile
+++ b/Makefile
@@ -144,7 +144,7 @@ $(LIBX264): .depend $(OBJS) $(OBJASM)
 	$(if $(RANLIB), $(RANLIB) $@)
 
 $(SONAME): .depend $(OBJS) $(OBJASM) $(OBJSO)
-	$(LD)$@ $(OBJS) $(OBJASM) $(OBJSO) $(SOFLAGS) $(LDFLAGS)
+	$(LD)$@ $(OBJS) $(OBJASM) $(OBJSO) $(SOFLAGS) $(LDFLAGS) $(LDFLAGSSHLIB)
 
 x264$(EXE): $(OBJCLI) $(LIBX264)
 	$(LD)$@ $+ $(LDFLAGSCLI) $(LDFLAGS)
diff --git a/configure b/configure
index 1a7cb33..31ca5e3 100755
--- a/configure
+++ b/configure
@@ -215,6 +215,7 @@ compiler="GNU"
 
 CFLAGS="$CFLAGS -Wall -I."
 LDFLAGS="$LDFLAGS"
+LDFLAGSSHLIB="$LDFLAGSSHLIB"
 LDFLAGSCLI="$LDFLAGSCLI"
 ASFLAGS="$ASFLAGS"
 HAVE_GETOPT_LONG=1
@@ -818,7 +819,8 @@ if [ "$pic" = "yes" ] ; then
     CFLAGS="$CFLAGS -fPIC"
     ASFLAGS="$ASFLAGS -DPIC"
     # resolve textrels in the x86 asm
-    cc_check stdio.h -Wl,-Bsymbolic && LDFLAGS="$LDFLAGS -Wl,-Bsymbolic"
+    cc_check stdio.h "-shared -Wl,-Bsymbolic" && LDFLAGSSHLIB="$LDFLAGSSHLIB -Wl,-Bsymbolic"
+    [ $SYS = SunOS -a "$ARCH" = "X86" ] && LDFLAGSSHLIB="$LDFLAGSSHLIB -mimpure-text"
 fi
 
 if [ "$debug" != "yes" -a "$gprof" != "yes" ]; then
@@ -938,6 +940,7 @@ DEPMM=$DEPMM
 DEPMT=$DEPMT
 LD=$LD
 LDFLAGS=$LDFLAGS
+LDFLAGSSHLIB=$LDFLAGSSHLIB
 LDFLAGSCLI=$LDFLAGSCLI
 LIBX264=$LIBX264
 AR=$AR
-- 
1.7.4



More information about the x264-devel mailing list