[PATCH v3] x86-64: Add -z mark-plt and -z nomark-plt

H.J. Lu hjl.tools@gmail.com
Wed Jan 17 16:12:11 GMT 2024


On Wed, Jan 17, 2024 at 3:02 AM Xi Ruoyao <xry111@xry111.site> wrote:
>
> Hi H.J.,
>
> When I test Binutils-2.41.90 I get 4 test failures regarding mark-plt:
>
> ./ld/ld.log:FAIL: ld-x86-64/mark-plt-1b
> ./ld/ld.log:FAIL: ld-x86-64/mark-plt-1d
> ./ld/ld.log:FAIL: ld-x86-64/mark-plt-1b-x32
> ./ld/ld.log:FAIL: ld-x86-64/mark-plt-1d-x32
>
> It seems related to --enable-default-hash-style=gnu: for mark-plt-1b
> with --hash-style=both I get the same dump as the .d file:
>
> 0000000000001010 <bar@plt>:
>     1010:       ff 25 32 11 00 00       jmp    *0x1132(%rip)        # 2148 <bar>
>     1016:       68 00 00 00 00          push   $0x0
>     101b:       e9 e0 ff ff ff          jmp    1000 <bar@plt-0x10>
>
> But with --hash-style=gnu:
>
> 0000000000001010 <bar@plt>:
>     1010:       ff 25 22 11 00 00       jmp    *0x1122(%rip)        # 2138 <bar>
>     1016:       68 00 00 00 00          push   $0x0
>     101b:       e9 e0 ff ff ff          jmp    1000 <bar@plt-0x10>
>
> The simplest "fix" would be adding --hash-style=both for these tests but
> I'm not sure if doing so is proper.
>
> On Thu, 2023-09-28 at 08:38 -0700, H.J. Lu via Binutils wrote:
> > diff --git a/ld/testsuite/ld-x86-64/mark-plt-1b.d b/ld/testsuite/ld-x86-64/mark-plt-1b.d
> > new file mode 100644
> > index 00000000000..dc046c031eb
> > --- /dev/null
> > +++ b/ld/testsuite/ld-x86-64/mark-plt-1b.d
> > @@ -0,0 +1,16 @@
> > +#source: mark-plt-1.s
> > +#as: --64
> > +#ld: -melf_x86_64 -shared -z mark-plt
> > +#objdump: -dw
> > +
> > +#...
> > +0+1010 <bar@plt>:
> > + +1010:      ff 25 32 11 00 00       jmp    \*0x1132\(%rip\)        # 2148 <bar>
> > + +1016:      68 00 00 00 00          push   \$0x0
> > + +101b:      e9 e0 ff ff ff          jmp    1000 <bar@plt-0x10>
> > +
> > +Disassembly of section .text:
> > +
> > +0+1020 <foo>:
> > + +1020:      e8 eb ff ff ff          call   1010 <bar@plt>
> > +#pass
>
> --
> Xi Ruoyao <xry111@xry111.site>
> School of Aerospace Science and Technology, Xidian University

Thanks for reporting it.  Fixed by:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=16666ccc91295d1568c5c2cb0e7600694840dfd9

-- 
H.J.


More information about the Binutils mailing list