[PATCH] x86: Report expected register for elf_x86_tls_error_indirect_call

H.J. Lu hjl.tools@gmail.com
Thu Aug 29 12:35:02 GMT 2024


On Thu, Aug 29, 2024 at 12:27 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 28.08.2024 14:03, H.J. Lu wrote:
> > @@ -3265,8 +3266,9 @@ _bfd_x86_elf_link_report_tls_transition_error
> >        info->callbacks->einfo
> >       /* xgettext:c-format */
> >       (_("%pB(%pA+0x%v): relocation %s against `%s' must be used "
> > -        "in indirect CALL only\n"),
> > -      abfd, asect, rel->r_offset, from_reloc_name, name);
> > +        "in indirect CALL with %s register only\n"),
> > +      abfd, asect, rel->r_offset, from_reloc_name, name,
> > +      htab->ax_register);
> >        break;
>
> Since CALL is still a requirement, ...
>
> > --- a/ld/testsuite/ld-i386/tlsgdesc2.s
> > +++ b/ld/testsuite/ld-i386/tlsgdesc2.s
> > @@ -1,8 +1,8 @@
> >       .text
> >       .globl _start
> >  _start:
> > -     leal    foo@tlsdesc(%ebx), %eax
> > -     jmp     *foo@tlscall(%eax)
> > +     leal    foo@tlsdesc(%ebx), %ecx
> > +     call    *foo@tlscall(%ecx)
>
> ... why do you drop the JMP case? Imo you want to add the CALL+%ecx case here
> (and then similarly in the 64-bit testcase). Or, if multiple diagnostics can't
> be tested in a single testcase fdor some reason, add a new one.

The purpose of this test is to check the linker error message of
elf_x86_tls_error_indirect_call.  We don't need another test for
the same elf_x86_tls_error_indirect_call message.

> That said, the limiting to just %eax / %rax seems overly restrictive to me.
> This way multiple accesses can't be interleaved.
>
> Jan



-- 
H.J.


More information about the Binutils mailing list