This is the mail archive of the libffi-discuss@sourceware.org mailing list for the libffi 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]

libffi-3.0.10 on powerpc64-unknown-linux-gnu fails 50 tests


Dear libffi folks :

I have been very carefully building a software stack into /usr/local where the
criteria for "make install" is that every test must pass from the testsuite. I
have been wrestling with libffi 3.0.10 and
have found a few startling issues :

1) the ability to make a 64-bit testsuite seems lacking

2) the Makefiles seems to miss correct CFLAGS/CXXFLAGS

3) if one does not set CFLAGS/CXXFLAGS then a simple configure
   results in 32-bit objects on a 64-bit machine. Despite
   this sort of invokation :

$ ./configure --libexecdir=/usr/local/libexec/ppc970 \
--libdir=/usr/local/lib/ppc970 --build=powerpc64-unknown-linux-gnu \
--prefix=/usr/local --enable-shared --enable-static \
--enable-portable-binary --enable-purify-safety --enable-debug \
--with-gcc-arch=970

While one may build the binaries as correct ppc64 ELF output the
testsuite will fail *every* test.

If I set the folowing env vars :


CC=gcc
CFLAGS=-L/usr/local/lib -g -mcpu=970 -mtune=970 -maltivec -mabi=altivec
-mvrsave -m64 -mpowerpc64 -mfull-toc -malign-power -mupdate -mcall-linux
-msvr4-struct-return -pthread -Wall -fexceptions
CONFIG_SHELL=/bin/bash
CPPFLAGS=-I/usr/local/include
CXX=g++
CXXFLAGS=-L/usr/local/lib -g -mcpu=970 -mtune=970 -maltivec -mabi=altivec
-mvrsave -m64 -mpowerpc64 -mfull-toc -malign-power -mupdate -mcall-linux
-msvr4-struct-return -pthread -Wall -fexceptions
LANG=C
LC_ALL=C
LC_COLLATE=C
LC_CTYPE=C
LC_MESSAGES=C
LC_MONETARY=C
LC_NUMERIC=C
LC_TIME=C
LD_LIBRARY_PATH=/usr/local/lib/ppc970
LD_OPTIONS=-L/usr/local/lib/ppc970
LD_RUN_PATH=/usr/local/lib/ppc970
MANPATH=/usr/local/share/man:/usr/share/man
PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/schily/bin

then configure and make I do get correct 64-bit ELF output binaries thus :

dclarke@charon:~/build/libffi-3.0.10-ppc970$ file /usr/local/lib/ppc970/* |
grep ELF | cut -f2 -d\: | sed 's/^[ \t]*//' | sort -u
ELF 64-bit MSB shared object, 64-bit PowerPC or cisco 7500, version 1 (SYSV),
dynamically linked, not stripped


However make check fails all tests. Yes, ALL of them.

I lookinto these two files :

    ./testsuite/libffi.special/special.exp
    ./testsuite/libffi.call/call.exp

There I see that the CFLAGS have been ignored and "-m64" gcc flag is absent
and thus every test was being run as if a 32-bit lib should be available. Thus
all tests fails. If I insert the required "-m64" then I get this result :

                === libffi Summary ===

# of expected passes            1564
# of unexpected failures        50
# of unsupported tests          15
gmake[3]: *** [check-DEJAGNU] Error 1
gmake[3]: Leaving directory
`/home/dclarke/build/libffi-3.0.10-ppc970/powerpc64-unknown-linux-gnu/testsuite'
gmake[2]: *** [check-am] Error 2
gmake[2]: Leaving directory
`/home/dclarke/build/libffi-3.0.10-ppc970/powerpc64-unknown-linux-gnu/testsuite'
gmake[1]: *** [check-recursive] Error 1
gmake[1]: Leaving directory
`/home/dclarke/build/libffi-3.0.10-ppc970/powerpc64-unknown-linux-gnu' gmake:
*** [check] Error 2


This is not at all acceptable for install.

Therefore I have to ask, has anyone built libffi for powerpc64 with all tests
passing ?  do I need to build 32-bit libs and insert the resultant output libs
into /usr/local/lib and NOT the more correct /usr/local/lib/ppc970 ?

As a bit of info, if we set LD_DEBUG=libs then we can see the full search path
that the dynamic runtime linker follows to resolve the libs "NEEDED" in the
ELF headers of a given binary which also includes a correct "RPATH".

consider grep as an example :

dclarke@charon:~/build/libffi-3.0.10-ppc970$ file /usr/local/bin/grep
/usr/local/bin/grep: ELF 64-bit MSB executable, 64-bit PowerPC or cisco 7500,
version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18,
not stripped

dclarke@charon:~/build/libffi-3.0.10-ppc970$ objdump -x /usr/local/bin/grep |
head -60

/usr/local/bin/grep:     file format elf64-powerpc
/usr/local/bin/grep
architecture: powerpc:common64, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x0000000010049580

Program Header:
    PHDR off    0x0000000000000040 vaddr 0x0000000010000040 paddr
0x0000000010000040 align 2**3
         filesz 0x0000000000000188 memsz 0x0000000000000188 flags r-x
  INTERP off    0x00000000000001c8 vaddr 0x00000000100001c8 paddr
0x00000000100001c8 align 2**0
         filesz 0x0000000000000011 memsz 0x0000000000000011 flags r--
    LOAD off    0x0000000000000000 vaddr 0x0000000010000000 paddr
0x0000000010000000 align 2**16
         filesz 0x0000000000038184 memsz 0x0000000000038184 flags r-x
    LOAD off    0x0000000000038188 vaddr 0x0000000010048188 paddr
0x0000000010048188 align 2**16
         filesz 0x0000000000003360 memsz 0x0000000000005050 flags rw-
 DYNAMIC off    0x0000000000038378 vaddr 0x0000000010048378 paddr
0x0000000010048378 align 2**3
         filesz 0x00000000000001e0 memsz 0x00000000000001e0 flags rw-
    NOTE off    0x00000000000001dc vaddr 0x00000000100001dc paddr
0x00000000100001dc align 2**2
         filesz 0x0000000000000044 memsz 0x0000000000000044 flags r--
EH_FRAME off    0x000000000003813c vaddr 0x000000001003813c paddr
0x000000001003813c align 2**2
         filesz 0x0000000000000014 memsz 0x0000000000000014 flags r--

Dynamic Section:
  NEEDED               libiconv.so.2
  NEEDED               libpthread.so.0
  NEEDED               libc.so.6
  RPATH                /usr/local/lib/ppc970
  INIT                 0x0000000010049598
  FINI                 0x00000000100495b0
  HASH                 0x0000000010000220
  GNU_HASH             0x0000000010000650
  STRTAB               0x0000000010001318
  SYMTAB               0x0000000010000688
  STRSZ                0x0000000000000516
  SYMENT               0x0000000000000018
  DEBUG                0x0000000000000000
  PLTGOT               0x000000001004b4e8
  PLTRELSZ             0x0000000000000a20
  PLTREL               0x0000000000000007
  JMPREL               0x0000000010001bf8
  0x70000000           0x0000000010034cc0
  RELA                 0x00000000100019a0
  RELASZ               0x0000000000000258
  RELAENT              0x0000000000000018
  VERNEED              0x0000000010001940
  VERNEEDNUM           0x0000000000000002
  VERSYM               0x000000001000182e

Version References:
  required from libpthread.so.0:
    0x0d696913 0x00 03 GLIBC_2.3
  required from libc.so.6:
    0x0d696914 0x00 05 GLIBC_2.4
    0x09691974 0x00 04 GLIBC_2.3.4
    0x0d696913 0x00 02 GLIBC_2.3

Thus ldd tells us all is good and correct in the world :

dclarke@charon:~/build/libffi-3.0.10-ppc970$ ldd /usr/local/bin/grep
        linux-vdso64.so.1 =>  (0x00000fff7c920000)
        libiconv.so.2 => /usr/local/lib/ppc970/libiconv.so.2
(0x00000fff7c7fa000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00000fff7c7b7000)
libc.so.6 => /lib64/libc.so.6 (0x00000fff7c5fc000)
        /lib64/ld64.so.1 (0x000000003e83d000)

Also LD_DEBUG reveals the path the rtld follows :


dclarke@charon:~/build/libffi-3.0.10-ppc970$ LD_DEBUG=libs grep --version
     15049:     find library=libiconv.so.2 [0]; searching
     15049:      search
path=/usr/local/lib/ppc970/tls/ppc970/altivec:/usr/local/lib/ppc970/tls/ppc970:/usr/local/lib/ppc970/tls/altivec:/usr/local/lib/ppc970/tls:/usr/local/lib/ppc970/ppc970/altivec:/usr/local/lib/ppc970/ppc970:/usr/local/lib/ppc970/altivec:/usr/local/lib/ppc970
               (RPATH from file grep)
     15049:       trying
file=/usr/local/lib/ppc970/tls/ppc970/altivec/libiconv.so.2
     15049:       trying file=/usr/local/lib/ppc970/tls/ppc970/libiconv.so.2
15049:       trying file=/usr/local/lib/ppc970/tls/altivec/libiconv.so.2
15049:       trying file=/usr/local/lib/ppc970/tls/libiconv.so.2 15049:  
    trying
file=/usr/local/lib/ppc970/ppc970/altivec/libiconv.so.2
     15049:       trying file=/usr/local/lib/ppc970/ppc970/libiconv.so.2
15049:       trying file=/usr/local/lib/ppc970/altivec/libiconv.so.2
15049:       trying file=/usr/local/lib/ppc970/libiconv.so.2
     15049:
     15049:     find library=libpthread.so.0 [0]; searching
     15049:      search path=/usr/local/lib/ppc970              (RPATH from
file grep)
     15049:       trying file=/usr/local/lib/ppc970/libpthread.so.0 15049:    
 search path=/usr/local/lib/ppc970              (RPATH from
file grep)
     15049:       trying file=/usr/local/lib/ppc970/libpthread.so.0 15049:    
 search cache=/etc/ld.so.cache
     15049:       trying file=/lib64/libpthread.so.0
     15049:
     15049:     find library=libc.so.6 [0]; searching
     15049:      search path=/usr/local/lib/ppc970              (RPATH from
file grep)
     15049:       trying file=/usr/local/lib/ppc970/libc.so.6
     15049:      search path=/usr/local/lib/ppc970              (RPATH from
file grep)
     15049:       trying file=/usr/local/lib/ppc970/libc.so.6
     15049:      search cache=/etc/ld.so.cache
     15049:       trying file=/lib64/libc.so.6
     15049:
     15049:
     15049:     calling init: /lib64/libpthread.so.0
     15049:
     15049:
     15049:     calling init: /lib64/libc.so.6
     15049:
     15049:
     15049:     calling init: /usr/local/lib/ppc970/libiconv.so.2
     15049:
     15049:
     15049:     initialize program: grep
     15049:
     15049:
     15049:     transferring control: grep
     15049:
grep (GNU grep) 2.10
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO
WARRANTY, to the extent permitted by law.

Written by Mike Haertel and others, see
<http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.


Therefore I think my approach is correct. That libffi should be built with the
CFLAGS and configure options I speecified to get the desired 64-bit result.
However, the testsuite fails for a 64-bit build unless I modify a few files.
Even then 50 tests still fail.

Is there something else I am missing here ?


Dennis


-- 
--
http://pgp.mit.edu:11371/pks/lookup?op=vindex&search=0x1D936C72FA35B44B
+-------------------------+-----------------------------------+
| Dennis Clarke           | Solaris and Linux and Open Source |
| dclarke@blastwave.org   | Respect for open standards.       |
+-------------------------+-----------------------------------+





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