https://sourceware.org/bugzilla/show_bug.cgi?id=33177

            Bug ID: 33177
           Summary: pr26590 etc. FAIL due to Solaris ABI symbols
           Product: binutils
           Version: 2.45
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: ro at gcc dot gnu.org
  Target Milestone: ---
            Target: *-*-solaris2.11

A couple of ld tests FAIL on Solaris for the same reason:

FAIL: Build pr26590 (1)
FAIL: Run with pr14862-1.c libpr14862.so
FAIL: pr26580-3

The first of those FAILs due to

extra regexps in
/vol/src/gnu/binutils/hg/binutils-2.45-branch/local/ld/testsuite/ld-elf/pr26590.err
starting with "^.*: tmpdir/libpr26590b.so: undefined reference to `f1'$"
EOF from tmpdir/ld.messages
Linker was expected to give error or warning

while on Linux, I get the expected

/var/gcc/binutils/i686/obj/binutils-2.45-branch-g3/ld/tmpdir/ld/collect-ld:
tmpdir/libpr26590b.so: undefined reference to `f1'

It turns out that libpr26590b.so on Solaris has a dependency on libpr26590a.so]

$ readelf -d tmpdir/libpr26590b.so | grep -i needed
 0x00000001 (NEEDED)                     Shared library:
[tmpdir/libpr26590a.so]
 0x00000001 (NEEDED)                     Shared library: [libc.so.1]

while on Linux it has not:

$ readelf -d tmpdir/libpr26590b.so|grep -i needed
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]

and the Solaris executable depends on both libpr26590[ab].so:

$ readelf -d tmpdir/pr26590 | grep -i needed
 0x00000001 (NEEDED)                     Shared library:
[tmpdir/libpr26590a.so]
 0x00000001 (NEEDED)                     Shared library:
[tmpdir/libpr26590b.so]
 0x00000001 (NEEDED)                     Shared library: [libc.so.1]

Performing both links with ld -M, on Solaris I get

As-needed library included to satisfy reference by file (symbol)

tmpdir/libpr26590a.so         /usr/lib/crt1.o (_GLOBAL_OFFSET_TABLE_)
tmpdir/libpr26590b.so         tmpdir/pr26590c.o (f2)
libc.so.1                     /usr/lib/crt1.o (_exit@@SYSVABI_1.3)

while on Linux there's

As-needed library included to satisfy reference by file (symbol)

tmpdir/libpr26590b.so         tmpdir/pr26590c.o (f2)
libc.so.6                     tmpdir/pr26590c.o (puts@@GLIBC_2.0)

This happens because every executable and shared object is required to define
a couple of symbols, which is implemented in emultempl/solaris2.em
(elf_solaris2_before_allocation).

To avoid the resulting failures, I wondered if there's a way to treat those
symbols specially to avoid defeating --as-needed in this way, but couldn't
easily find any (probably in bfd/elflink.c?).

Any help would be appreciated.

Thanks.
  Rainer

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to