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

H.J. Lu hjl.tools@gmail.com
Mon Aug 18 12:29:56 GMT 2025


On Mon, Jul 28, 2025 at 6:50 AM Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
>
> 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.
>
> Ok for trunk?

OK.

>         Rainer
>
> --
> -----------------------------------------------------------------------------
> Rainer Orth, Center for Biotechnology, Bielefeld University
>
>
> 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.
>


-- 
H.J.


More information about the Binutils mailing list