ld: testsuite: Fix no-plt tests on Solaris/i386

Several no-plt tests FAIL on 32-bit Solaris/x86:

FAIL: Build libno-plt-1b.so
FAIL: No PLT (dynamic 1a)
FAIL: No PLT (dynamic 1b)
FAIL: No PLT (dynamic 1c)
FAIL: No PLT (PIE 1e)
FAIL: No PLT (PIE 1f)
FAIL: No PLT (PIE 1g)

The failure mode is always similar, e.g.

../binutils/objdump -dwrj.text tmpdir/libno-plt-1b.so > dump.out
regexp_diff match failure
regexp "^ +[a-f0-9]+:   8b 80 ([0-9a-f]{2} ){4}[        ]+mov +-0x[a-f0-9]+\(%eax\),%eax$"
line   " 4aa:   8b 80 14 00 00 00       mov    0x14(%eax),%eax"
regexp_diff match failure
regexp "^ +[a-f0-9]+:   ff a0 ([0-9a-f]{2} ){4}[        ]+jmp +\*-0x[0-9a-f]+\(%eax\)$"
line   " 4ca:   ff a0 14 00 00 00       jmp    *0x14(%eax)"

i.e. there's a positive offset from the GOT instead of the expected
negative one.  AFAICS that's because there are additional GOT entries on
the Solaris side (printed with elfdump -G since there seems to be no
support for that in either readelf or objdump):

* Solaris/i386:

Global Offset Table Section:  .got
  index    addr  value  pending relocation
    [0]  0x15f4 0x1514
    [1]  0x15f8      0
    [2]  0x15fc      0
    [3]  0x1600  0x3a6  R_386_JMP_SLOT      __cxa_finalize
    [4]  0x1604      0  R_386_GLOB_DAT      _ITM_deregisterTMCloneTable
    [5]  0x1608      0  R_386_GLOB_DAT      func

* Linux/i686:

Global Offset Table Section:  .got
  index    addr value  pending relocation
    [0]  0x3fe0     0  R_386_GLOB_DAT      _ITM_deregisterTMCloneTable
    [1]  0x3fe4     0  R_386_GLOB_DAT      __cxa_finalize
    [2]  0x3fe8     0  R_386_GLOB_DAT      __gmon_start__
    [3]  0x3fec     0  R_386_GLOB_DAT      func

This patch fixes this by making the sign optional in affected cases.

Tested on i386-pc-solaris2.11 and i686-pc-linux-gnu.

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

	ld:
	* testsuite/ld-i386/libno-plt-1b.dd: Allow for positive GOT
	offsets.
	* testsuite/ld-i386/no-plt-1a.dd: Likewise.
	* testsuite/ld-i386/no-plt-1b.dd: Likewise.
	* testsuite/ld-i386/no-plt-1c.dd: Likewise.
	* testsuite/ld-i386/no-plt-1e.dd: Likewise.
	* testsuite/ld-i386/no-plt-1f.dd: Likewise.
	* testsuite/ld-i386/no-plt-1g.dd: Likewise.
This commit is contained in:
Rainer Orth
2025-08-18 16:00:42 +02:00
parent 9e5fdac9ac
commit fc6423d965
8 changed files with 44 additions and 33 deletions

View File

@@ -1,3 +1,14 @@
2025-08-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* testsuite/ld-i386/libno-plt-1b.dd: Allow for positive GOT
offsets.
* testsuite/ld-i386/no-plt-1a.dd: Likewise.
* testsuite/ld-i386/no-plt-1b.dd: Likewise.
* testsuite/ld-i386/no-plt-1c.dd: Likewise.
* testsuite/ld-i386/no-plt-1e.dd: Likewise.
* testsuite/ld-i386/no-plt-1f.dd: Likewise.
* testsuite/ld-i386/no-plt-1g.dd: Likewise.
2025-08-17 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* testsuite/ld-ctf/ctf.exp (ASFLAGS): Append -Av8plus on

View File

@@ -9,11 +9,11 @@ Disassembly of section .text:
[0-9a-f]+ <get_func>:
+[a-f0-9]+: e8 ([0-9a-f]{2} ){4}[ ]+call +[a-f0-9]+ <__x86.get_pc_thunk.ax>
+[a-f0-9]+: 05 ([0-9a-f]{2} ){4}[ ]+add +\$0x[a-f0-9]+,%eax
+[a-f0-9]+: 8b 80 ([0-9a-f]{2} ){4}[ ]+mov +-0x[a-f0-9]+\(%eax\),%eax
+[a-f0-9]+: 8b 80 ([0-9a-f]{2} ){4}[ ]+mov +-?0x[a-f0-9]+\(%eax\),%eax
+[a-f0-9]+: c3 ret
#...
[0-9a-f]+ <call_func>:
+[a-f0-9]+: e8 ([0-9a-f]{2} ){4}[ ]+call +[a-f0-9]+ <__x86.get_pc_thunk.ax>
+[a-f0-9]+: 05 ([0-9a-f]{2} ){4}[ ]+add +\$0x[a-f0-9]+,%eax
+[a-f0-9]+: ff a0 ([0-9a-f]{2} ){4}[ ]+jmp +\*-0x[0-9a-f]+\(%eax\)
+[a-f0-9]+: ff a0 ([0-9a-f]{2} ){4}[ ]+jmp +\*-?0x[0-9a-f]+\(%eax\)
#pass

View File

@@ -23,14 +23,14 @@ Disassembly of section .text:
+[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr16 call [0-9a-f]+ <call_func>
+[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax
+[a-f0-9]+: 75 15 jne +[0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: 8d 83 ([0-9a-f]{2} ){4}[ ]+lea +-0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: 8d 83 ([0-9a-f]{2} ){4}[ ]+lea +-?0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: 83 ec 0c sub \$0xc,%esp
+[a-f0-9]+: 50 push %eax
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 83 c4 18 add \$0x18,%esp
+[a-f0-9]+: 5b pop %ebx
+[a-f0-9]+: c3 ret
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
#...
[0-9a-f]+ <get_func>:
+[a-f0-9]+: e8 ([0-9a-f]{2} ){4}[ ]+call +[a-f0-9]+ <__x86.get_pc_thunk.ax>

View File

@@ -11,24 +11,24 @@ Disassembly of section .text:
+[a-f0-9]+: e8 ([0-9a-f]{2} ){4}[ ]+call [a-f0-9]+ <__x86.get_pc_thunk.bx>
+[a-f0-9]+: 81 c3 ([0-9a-f]{2} ){4}[ ]+add +\$0x[a-f0-9]+,%ebx
+[a-f0-9]+: 83 ec 08 sub \$0x8,%esp
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 3b 83 ([0-9a-f]{2} ){4}[ ]+cmp +-0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 3b 83 ([0-9a-f]{2} ){4}[ ]+cmp +-?0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: 75 39 jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: 8b 93 ([0-9a-f]{2} ){4}[ ]+mov +-0x[0-9a-f]+\(%ebx\),%edx
+[a-f0-9]+: 8b 93 ([0-9a-f]{2} ){4}[ ]+mov +-?0x[0-9a-f]+\(%ebx\),%edx
+[a-f0-9]+: 39 02 cmp %eax,\(%edx\)
+[a-f0-9]+: 75 2f jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax
+[a-f0-9]+: 75 22 jne +[0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax
+[a-f0-9]+: 75 15 jne +[0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: 8d 83 ([0-9a-f]{2} ){4}[ ]+lea +-0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: 83 ec 0c sub \$0xc,%esp
+[a-f0-9]+: 50 push %eax
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 83 c4 18 add \$0x18,%esp
+[a-f0-9]+: 5b pop %ebx
+[a-f0-9]+: c3 ret
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
#pass

View File

@@ -11,24 +11,24 @@ Disassembly of section .text:
+[a-f0-9]+: e8 ([0-9a-f]{2} ){4}[ ]+call [a-f0-9]+ <__x86.get_pc_thunk.bx>
+[a-f0-9]+: 81 c3 ([0-9a-f]{2} ){4}[ ]+add +\$0x[a-f0-9]+,%ebx
+[a-f0-9]+: 83 ec 08 sub \$0x8,%esp
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 81 f8 ([0-9a-f]{2} ){4}[ ]+cmp +\$0x[0-9a-f]+,%eax
+[a-f0-9]+: 75 39 jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: 8b 93 ([0-9a-f]{2} ){4}[ ]+mov +-0x[0-9a-f]+\(%ebx\),%edx
+[a-f0-9]+: 8b 93 ([0-9a-f]{2} ){4}[ ]+mov +-?0x[0-9a-f]+\(%ebx\),%edx
+[a-f0-9]+: 39 02 cmp %eax,\(%edx\)
+[a-f0-9]+: 75 2f jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr16 call [0-9a-f]+ <func>
+[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax
+[a-f0-9]+: 75 22 jne +[0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax
+[a-f0-9]+: 75 15 jne +[0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: 8d 83 ([0-9a-f]{2} ){4}[ ]+lea +-0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: 83 ec 0c sub \$0xc,%esp
+[a-f0-9]+: 50 push %eax
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 83 c4 18 add \$0x18,%esp
+[a-f0-9]+: 5b pop %ebx
+[a-f0-9]+: c3 ret
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
#pass

View File

@@ -12,7 +12,7 @@ Disassembly of section .text:
+[a-f0-9]+: 81 c3 ([0-9a-f]{2} ){4}[ ]+add +\$0x[a-f0-9]+,%ebx
+[a-f0-9]+: 83 ec 08 sub \$0x8,%esp
+[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr16 call [0-9a-f]+ <get_func>
+[a-f0-9]+: 3b 83 ([0-9a-f]{2} ){4}[ ]+cmp +-0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: 3b 83 ([0-9a-f]{2} ){4}[ ]+cmp +-?0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: 75 39 jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: 8d 93 ([0-9a-f]{2} ){4}[ ]+lea +0x[a-f0-9]+\(%ebx\),%edx
+[a-f0-9]+: 39 02 cmp %eax,\(%edx\)
@@ -26,11 +26,11 @@ Disassembly of section .text:
+[a-f0-9]+: 8d 83 ([0-9a-f]{2} ){4}[ ]+lea +-0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: 83 ec 0c sub \$0xc,%esp
+[a-f0-9]+: 50 push %eax
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 83 c4 18 add \$0x18,%esp
+[a-f0-9]+: 5b pop %ebx
+[a-f0-9]+: c3 ret
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
#...
[0-9a-f]+ <get_func>:
+[a-f0-9]+: e8 ([0-9a-f]{2} ){4}[ ]+call +[a-f0-9]+ <__x86.get_pc_thunk.ax>

View File

@@ -11,24 +11,24 @@ Disassembly of section .text:
+[a-f0-9]+: e8 ([0-9a-f]{2} ){4}[ ]+call [a-f0-9]+ <__x86.get_pc_thunk.bx>
+[a-f0-9]+: 81 c3 ([0-9a-f]{2} ){4}[ ]+add +\$0x[a-f0-9]+,%ebx
+[a-f0-9]+: 83 ec 08 sub \$0x8,%esp
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 3b 83 ([0-9a-f]{2} ){4}[ ]+cmp +-0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 3b 83 ([0-9a-f]{2} ){4}[ ]+cmp +-?0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: 75 39 jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: 8b 93 ([0-9a-f]{2} ){4}[ ]+mov +-0x[0-9a-f]+\(%ebx\),%edx
+[a-f0-9]+: 8b 93 ([0-9a-f]{2} ){4}[ ]+mov +-?0x[0-9a-f]+\(%ebx\),%edx
+[a-f0-9]+: 39 02 cmp %eax,\(%edx\)
+[a-f0-9]+: 75 2f jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax
+[a-f0-9]+: 75 22 jne +[0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax
+[a-f0-9]+: 75 15 jne +[0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: 8d 83 ([0-9a-f]{2} ){4}[ ]+lea +-0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: 83 ec 0c sub \$0xc,%esp
+[a-f0-9]+: 50 push %eax
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 83 c4 18 add \$0x18,%esp
+[a-f0-9]+: 5b pop %ebx
+[a-f0-9]+: c3 ret
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
#pass

View File

@@ -11,24 +11,24 @@ Disassembly of section .text:
+[a-f0-9]+: e8 ([0-9a-f]{2} ){4}[ ]+call [a-f0-9]+ <__x86.get_pc_thunk.bx>
+[a-f0-9]+: 81 c3 ([0-9a-f]{2} ){4}[ ]+add +\$0x[a-f0-9]+,%ebx
+[a-f0-9]+: 83 ec 08 sub \$0x8,%esp
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 3b 83 ([0-9a-f]{2} ){4}[ ]+cmp +-0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 3b 83 ([0-9a-f]{2} ){4}[ ]+cmp +-?0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: 75 39 jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: 8b 93 ([0-9a-f]{2} ){4}[ ]+mov +-0x[0-9a-f]+\(%ebx\),%edx
+[a-f0-9]+: 8b 93 ([0-9a-f]{2} ){4}[ ]+mov +-?0x[0-9a-f]+\(%ebx\),%edx
+[a-f0-9]+: 39 02 cmp %eax,\(%edx\)
+[a-f0-9]+: 75 2f jne [0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr16 call [0-9a-f]+ <func>
+[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax
+[a-f0-9]+: 75 22 jne +[0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 3d 78 56 34 12 cmp \$0x12345678,%eax
+[a-f0-9]+: 75 15 jne +[0-9a-f]+ <check\+0x[0-9a-f]+>
+[a-f0-9]+: 8d 83 ([0-9a-f]{2} ){4}[ ]+lea +-0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: 83 ec 0c sub \$0xc,%esp
+[a-f0-9]+: 50 push %eax
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: 83 c4 18 add \$0x18,%esp
+[a-f0-9]+: 5b pop %ebx
+[a-f0-9]+: c3 ret
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-0x[0-9a-f]+\(%ebx\)
+[a-f0-9]+: ff 93 ([0-9a-f]{2} ){4}[ ]+call +\*-?0x[0-9a-f]+\(%ebx\)
#pass