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]

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


On Sun, Apr 06, 2008 at 09:21:20AM +0200, Andreas Schwab wrote:
> Aurelien Jarno <aurelien@aurel32.net> writes:
> 
> > 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
> > -    ;;
> >    *)
> 
> The case statement is pointless now since it only has a catch-all
> pattern.
> 

Please find below a new patch to fix this issue.

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	6 Apr 2008 14:03:13 -0000
@@ -18909,20 +18909,10 @@ case "${host}" in
 *-*-linux*)
   # 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
-      WIN32LIBADD="-L../libiberty/pic -liberty"
-    fi
-  ;;
-  esac
+  x=`sed -n -e 's/^[ 	]*PICFLAG[ 	]*=[ 	]*//p' < ../libiberty/Makefile | sed -n '$p'`
+  if test -n "$x"; then
+    WIN32LIBADD="-L../libiberty/pic -liberty"
+  fi
   ;;
 esac
 
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	6 Apr 2008 14:03:13 -0000
@@ -492,22 +492,12 @@ case "${host}" in
 *-*-linux*)
   # 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'`
+  x=`sed -n -e 's/^[ 	]*PICFLAG[ 	]*=[ 	]*//p' < ../libiberty/Makefile | sed -n '$p'`
 changequote([,])dnl
-    if test -n "$x"; then
-      WIN32LIBADD="-L../libiberty/pic -liberty"
-    fi
-  ;;
-  esac
+  if test -n "$x"; then
+    WIN32LIBADD="-L../libiberty/pic -liberty"
+  fi
   ;;
 esac
 AC_SUBST(WIN32LDFLAGS)
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	6 Apr 2008 14:03:14 -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	6 Apr 2008 14:03:14 -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]