[PATCH] Using -fPIC for libiberty on s390x

Mike Frysinger vapier@gentoo.org
Mon Dec 5 06:03:00 GMT 2011


On Saturday 23 July 2011 06:51:53 Aurelien Jarno wrote:
> Building binutils on s390x leads to relocation issues:
> | /home/aurel32/binutils/bfd/../libiberty/pic/libiberty.a(hashtab.o): In
> | function `htab_create':
> | /home/aurel32/binutils/libiberty/../../libiberty/hashtab.c:408:(.text+0x
> | 5e4): relocation truncated to fit: R_390_GOT12 against symbol `xcalloc'
> | defined in .text section in
> | /home/aurel32/binutils/bfd/../libiberty/pic/libiberty.a(xmalloc.o)
> |
> | /home/aurel32/binutils/bfd/../libiberty/pic/libiberty.a(hashtab.o): In 
function `htab_try_create':
> | /home/aurel32/binutils/libiberty/../../libiberty/hashtab.c:414:(.text+0x6
> | 1c): relocation truncated to fit: R_390_GOT12 against symbol
> | `calloc@@GLIBC_2.2' defined in .text section in /lib/libc.so.6
> |
> | collect2: ld returned 1 exit status
> 
> Using -fPIC instead of -fpic there fixes the issue.
> 
> 2011-07-23  Aurelien Jarno  <aurelien@aurel32.net>
> 
> 	* configure.ac: Use -fPIC instead of -fpic on s390x.
> 
> --- a/libiberty/configure.ac
> +++ b/libiberty/configure.ac
> @@ -216,6 +216,7 @@
>  			  *-fpic* ) PICFLAG=-fpic ;;
>  			  * ) PICFLAG=-fPIC ;;
>  			esac ;;
> +    s390x*-*-*)		PICFLAG=-fPIC ;;
>      s390*-*-*)		PICFLAG=-fpic ;;
>      sh*-*-*)		PICFLAG=-fPIC ;;
>    esac

i've run into this issue on Gentoo systems and binutils-2.22.  but now with 
all the pic code being unified with gcc, we need to do:

--- a/config/picflag.m4
+++ b/config/picflag.m4
@@ -51,6 +51,9 @@ case "${$2}" in
     m68k-*-*)
 	$1=-fpic
 	;;
+    s390x*-*-*)
+	$1=-fPIC
+	;;
     s390*-*-*)
 	$1=-fpic
 	;;
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <https://sourceware.org/pipermail/binutils/attachments/20111205/fed5ccd8/attachment.sig>


More information about the Binutils mailing list