[PATCH] ld: testsuite: Fix "Build libpr23161c.so" etc. on Solaris/x86

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Mon Jul 28 14:12:08 GMT 2025


Two tests FAIL on Solaris/x86:

FAIL: Build libpr23161c.so
FAIL: Build pr23161c

The failure mode is the same in both cases:

ld/../binutils/readelf --dyn-syms -rW tmpdir/libpr23161c.so
regexp_diff match failure
regexp "^ +1: +[a-f0-9]+ +[0-9]+ +FUNC +GLOBAL +DEFAULT +[0-9]+ +foo$"
line   "     1: 000011b0     0 OBJECT  GLOBAL DEFAULT    7 _DYNAMIC"
extra lines in dump.out starting with "^     2: 00000180     0 OBJECT  GLOBAL DEFAULT    4 _PROCEDURE_LINKAGE_TABLE_$"
EOF from ld/testsuite/ld-elf/pr23161c.rd
output is
There are no relocations in this file.

Symbol table '.dynsym' contains 7 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 000011b0     0 OBJECT  GLOBAL DEFAULT    7 _DYNAMIC
     2: 00000180     0 OBJECT  GLOBAL DEFAULT    4 _PROCEDURE_LINKAGE_TABLE_
     3: 00000180    43 FUNC    GLOBAL DEFAULT    5 foo
     4: 00001214     0 NOTYPE  GLOBAL DEFAULT    8 _edata
     5: 00001208     0 OBJECT  GLOBAL DEFAULT    8 _GLOBAL_OFFSET_TABLE_
     6: 00001214     0 NOTYPE  GLOBAL DEFAULT    8 _end

The Solaris ABI requires additional symbols to be added to executables
and shared objects (cf. ld/emultempl/solaris2.em), so this patch allows
for additional entries.

Tested on {amd64, i386}-pc-solaris2.11, and {x86_64, i686}-pc-linux-gnu.

While the tests PASS on Solaris/i386, on amd64 the now FAIL in a
different manner when linking libpr23161c.so:

./ld-new: tmpdir/pr23161c.o: relocation R_X86_64_PC32 against symbol `_end' can not be used when making a shared object; recompile with -fPIC
./ld-new: final link failed: bad value

Ok for trunk.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2025-07-25  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	ld:
	* testsuite/ld-elf/pr23161c.rd: Allow for intervening symbols.
	* testsuite/ld-elf/pr23161d.rd: Likewise.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sol2-ld-testsuite-pr23161c.patch
Type: text/x-patch
Size: 1103 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20250728/0f85c731/attachment.bin>


More information about the Binutils mailing list