Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 581314 - sys-devel/libtool: wrong $LD="ld -m elf64ppc' on ppc64le platform
Summary: sys-devel/libtool: wrong $LD="ld -m elf64ppc' on ppc64le platform
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: PPC64 Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL: http://debbugs.gnu.org/cgi/bugreport....
Whiteboard:
Keywords:
Depends on:
Blocks: 580792
  Show dependency tree
 
Reported: 2016-04-27 05:26 UTC by Leno Hou
Modified: 2017-02-21 22:45 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Leno Hou 2016-04-27 05:26:00 UTC
1) As we might know, Gentoo has powerpc64le-unknown-linux-gnu compiler
leno@localhost ~ $ powerpc64le-unknown-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/usr/powerpc64le-unknown-linux-gnu/gcc-bin/5.3.0/powerpc64le-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/powerpc64le-unknown-linux-gnu/5.3.0/lto-wrapper
Target: powerpc64le-unknown-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-5.3.0/work/gcc-5.3.0/configure --host=powerpc64le-unknown-linux-gnu --build=powerpc64le-unknown-linux-gnu --prefix=/usr --bindir=/usr/powerpc64le-unknown-linux-gnu/gcc-bin/5.3.0 --includedir=/usr/lib/gcc/powerpc64le-unknown-linux-gnu/5.3.0/include --datadir=/usr/share/gcc-data/powerpc64le-unknown-linux-gnu/5.3.0 --mandir=/usr/share/gcc-data/powerpc64le-unknown-linux-gnu/5.3.0/man --infodir=/usr/share/gcc-data/powerpc64le-unknown-linux-gnu/5.3.0/info --with-gxx-include-dir=/usr/lib/gcc/powerpc64le-unknown-linux-gnu/5.3.0/include/g++-v5 --with-python-dir=/share/gcc-data/powerpc64le-unknown-linux-gnu/5.3.0/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 5.3.0 p1.0, pie-0.6.5' --enable-libstdcxx-time --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --disable-multilib --enable-altivec --disable-fixed-point --enable-targets=all --disable-libgcj --enable-libgomp --disable-libmudflap --disable-libssp --disable-libcilkrts --enable-lto --without-isl --enable-libsanitizer
Thread model: posix
gcc version 5.3.0 (Gentoo 5.3.0 p1.0, pie-0.6.5) 
    
  2) And the supported emulations
leno@localhost ~ $ powerpc64le-unknown-linux-gnu-ld -V
GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
  Supported emulations:
   elf64lppc
   elf32lppc
   elf32lppclinux
   elf32lppcsim
 
   3) But when I set CHOST="powerpc64le-unkown-linux-gnu" in Gentoo and execute aclocal, automake, libtoolize --copy --force, autoconf. When I glance in the latest m4/libtool.m4 :

if AC_TRY_EVAL(ac_compile); then
   case `/usr/bin/file conftest.o` in
     *32-bit*)
       case $host in
...
         powerpc64le-*linux*)
           LD="${LD-ld} -m elf32lppclinux"
           ;;
         powerpc64-*linux*)
           LD="${LD-ld} -m elf32ppclinux"
           ;;
...
     *64-bit*)
       case $host in
...
         powerpcle-*linux*)
           LD="${LD-ld} -m elf64lppc"
           ;;
         powerpc-*linux*)
           LD="${LD-ld} -m elf64ppc"
           ;;
...

seems linked to $LD='$LD-ld -m elf64ppc' and failed to compile packages. 


 4)  Below is my workaround patch and works fine for this case.  If this is OK for you, Could this to be merged in upstream? Thanks
leno@localhost ~/libtool $ cat configure-libtool-with-ppc64le.patch 
--- m4/libtool.m4.orig	2016-04-23 16:35:57.383197077 +0000
+++ m4/libtool.m4	2016-04-23 16:36:40.623197724 +0000
@@ -1417,10 +1417,10 @@
 	  x86_64-*linux*)
 	    LD="${LD-ld} -m elf_x86_64"
 	    ;;
-	  powerpcle-*linux*)
+	  powerpcle-*linux*|powerpc64le-*linux*)
 	    LD="${LD-ld} -m elf64lppc"
 	    ;;
-	  powerpc-*linux*)
+	  powerpc-*linux*|powerpc64-*linux*)
 	    LD="${LD-ld} -m elf64ppc"
 	    ;;
 	  s390*-*linux*|s390*-*tpf*)

Reproducible: Always

Actual Results:  
$LD='ld -m elf64ppc'

Expected Results:  
$LD='ld -m elf64lppc'
Comment 1 SpanKY gentoo-dev 2017-02-21 22:45:51 UTC
i've merged your patch into our libtool-2.4.6-r3 since upstream hasn't moved.  and because it looks correct to me :).

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=80ed801a322763a07fa50b04726a1fefb7ee2356