This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Build libiberty with -fPIC on Linux/MIPS hosts


When configured with --enable-shared and built with gcc-4.3, all 
binutils binaries segfault on on a Linux/MIPS. This even prevent
binutils to be built if the installed version has also been built with
--enable-shared.

The reason is that libiberty is not compiled with -fPIC, so it is built
with -mshared. The patch below fixes that.


2008-04-06  Aurelien Jarno  <aurelien@aurel32.net>

	* bfd/configure.in: Link with the PIC version of libiberty on
	Linux/MIPS hosts.
	* bfd/configure: Regenerate.
	* libiberty/configure.ac: use -fPIC on Linux/MIPS hosts.
	* libiberty/configure: Regenerate.

Index: bfd/configure
===================================================================
RCS file: /cvs/src/src/bfd/configure,v
retrieving revision 1.276
diff -u -d -p -r1.276 configure
--- bfd/configure	17 Mar 2008 22:17:28 -0000	1.276
+++ bfd/configure	5 Apr 2008 19:42:47 -0000
@@ -18910,12 +18910,6 @@ case "${host}" in
   # We borrow WIN32LIBADD so that the shared libbfd won't depend on
   # libiberty.a.
   case "${host}" in
-  mips*-*-linux*)
-    # Linux/MIPS uses PIC by default.
-    if test "$enable_shared" = "yes"; then
-      WIN32LIBADD="-L../libiberty -liberty"
-    fi
-    ;;
   *)
     x=`sed -n -e 's/^[ 	]*PICFLAG[ 	]*=[ 	]*//p' < ../libiberty/Makefile | sed -n '$p'`
     if test -n "$x"; then
Index: bfd/configure.in
===================================================================
RCS file: /cvs/src/src/bfd/configure.in,v
retrieving revision 1.239
diff -u -d -p -r1.239 configure.in
--- bfd/configure.in	14 Feb 2008 15:20:26 -0000	1.239
+++ bfd/configure.in	5 Apr 2008 19:42:47 -0000
@@ -493,12 +493,6 @@ case "${host}" in
   # We borrow WIN32LIBADD so that the shared libbfd won't depend on
   # libiberty.a.
   case "${host}" in
-  mips*-*-linux*)
-    # Linux/MIPS uses PIC by default.
-    if test "$enable_shared" = "yes"; then
-      WIN32LIBADD="-L../libiberty -liberty"
-    fi
-    ;;
   *)
 changequote(,)dnl
     x=`sed -n -e 's/^[ 	]*PICFLAG[ 	]*=[ 	]*//p' < ../libiberty/Makefile | sed -n '$p'`
Index: libiberty/configure
===================================================================
RCS file: /cvs/src/src/libiberty/configure,v
retrieving revision 1.90
diff -u -d -p -r1.90 configure
--- libiberty/configure	27 Mar 2008 14:16:54 -0000	1.90
+++ libiberty/configure	5 Apr 2008 19:42:48 -0000
@@ -3720,6 +3720,7 @@ if [ "${shared}" = "yes" ]; then
     i[34567]86-*-* | x86_64-*-*)
 			PICFLAG=-fpic ;;
     m68k-*-*)		PICFLAG=-fpic ;;
+    mips*-*-linux)	PICFLAG=-fPIC ;;
     powerpc*-*-aix*)	;;
     powerpc*-*-*)	PICFLAG=-fPIC ;;
     sparc*-*-*)		case "${CFLAGS}" in
Index: libiberty/configure.ac
===================================================================
RCS file: /cvs/src/src/libiberty/configure.ac,v
retrieving revision 1.38
diff -u -d -p -r1.38 configure.ac
--- libiberty/configure.ac	27 Mar 2008 14:16:54 -0000	1.38
+++ libiberty/configure.ac	5 Apr 2008 19:42:49 -0000
@@ -208,6 +208,7 @@ if [[ "${shared}" = "yes" ]]; then
     i[[34567]]86-*-* | x86_64-*-*)
 			PICFLAG=-fpic ;;
     m68k-*-*)		PICFLAG=-fpic ;;
+    mips*-*-linux)	PICFLAG=-fPIC ;;
     powerpc*-*-aix*)	;;
     powerpc*-*-*)	PICFLAG=-fPIC ;;
     sparc*-*-*)		case "${CFLAGS}" in

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]