public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [RFC] DT_X86_64_PLT* dependency
@ 2023-09-29 15:16 H.J. Lu
  2023-10-02 10:26 ` Florian Weimer
  0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2023-09-29 15:16 UTC (permalink / raw)
  To: GNU C Library

Hi,

I checked in a linker patch:

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

to generate DT_X86_64_PLT, DT_X86_64_PLTSZ and DT_X86_64_PLTENT for

https://gitlab.com/x86-psABIs/x86-64-ABI/-/commit/6d824a52a42d173eb838b879616c1be5870b593e

When these tags are generated, the r_addend field of the R_X86_64_JUMP_SLOT
relocation stores the offset of the indirect branch instruction.  However, glibc
versions which don't have this commit in glibc 2.36:

commit f8587a61892cbafd98ce599131bf4f103466f084
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri May 20 19:21:48 2022 -0700

    x86-64: Ignore r_addend for R_X86_64_GLOB_DAT/R_X86_64_JUMP_SLOT

    According to x86-64 psABI, r_addend should be ignored for R_X86_64_GLOB_DAT
    and R_X86_64_JUMP_SLOT.  Since linkers always set their r_addends to 0, we
    can ignore their r_addends.

    Reviewed-by: Fangrui Song <maskray@google.com>

won't ignore the r_addend value in the R_X86_64_JUMP_SLOT relocation.   Such
binaries will fail to run with these versions of glibc.  I am working
on a linker patch
to add a glibc version dependency similar to GLIBC_ABI_DT_RELR for DT_RELR.
Although this commit has been backported to glibc 2.33/2.34/2.35
release branches,
there may be 2.33/2.34/2.35 glibc binaries without the fix.   Should
binaries with
DT_X86_64_PLT tags depend on glibc 2.36 or 2.33?

Thanks.

-- 
H.J.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] DT_X86_64_PLT* dependency
  2023-09-29 15:16 [RFC] DT_X86_64_PLT* dependency H.J. Lu
@ 2023-10-02 10:26 ` Florian Weimer
  2023-10-03  7:44   ` H.J. Lu
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Weimer @ 2023-10-02 10:26 UTC (permalink / raw)
  To: H.J. Lu; +Cc: GNU C Library

* H. J. Lu:

> When these tags are generated, the r_addend field of the R_X86_64_JUMP_SLOT
> relocation stores the offset of the indirect branch instruction.  However, glibc
> versions which don't have this commit in glibc 2.36:
>
> commit f8587a61892cbafd98ce599131bf4f103466f084
> Author: H.J. Lu <hjl.tools@gmail.com>
> Date:   Fri May 20 19:21:48 2022 -0700
>
>     x86-64: Ignore r_addend for R_X86_64_GLOB_DAT/R_X86_64_JUMP_SLOT
>
>     According to x86-64 psABI, r_addend should be ignored for R_X86_64_GLOB_DAT
>     and R_X86_64_JUMP_SLOT.  Since linkers always set their r_addends to 0, we
>     can ignore their r_addends.
>
>     Reviewed-by: Fangrui Song <maskray@google.com>
>
> won't ignore the r_addend value in the R_X86_64_JUMP_SLOT relocation.   Such
> binaries will fail to run with these versions of glibc.  I am working
> on a linker patch
> to add a glibc version dependency similar to GLIBC_ABI_DT_RELR for DT_RELR.
> Although this commit has been backported to glibc 2.33/2.34/2.35
> release branches,
> there may be 2.33/2.34/2.35 glibc binaries without the fix. 

Can we reuse the GLIBC_ABI_DT_RELR marker?

> Should binaries with DT_X86_64_PLT tags depend on glibc 2.36 or 2.33?

I don't understand this question.  The binaries will  run on any system
that has the marker symbol.  Or do you suggest to use an existing glibc
symbol version?

Thanks,
Florian


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] DT_X86_64_PLT* dependency
  2023-10-02 10:26 ` Florian Weimer
@ 2023-10-03  7:44   ` H.J. Lu
  0 siblings, 0 replies; 3+ messages in thread
From: H.J. Lu @ 2023-10-03  7:44 UTC (permalink / raw)
  To: Florian Weimer; +Cc: GNU C Library

[-- Attachment #1: Type: text/plain, Size: 1674 bytes --]

On Mon, Oct 2, 2023, 6:26 PM Florian Weimer <fweimer@redhat.com> wrote:

> * H. J. Lu:
>
> > When these tags are generated, the r_addend field of the
> R_X86_64_JUMP_SLOT
> > relocation stores the offset of the indirect branch instruction.
> However, glibc
> > versions which don't have this commit in glibc 2.36:
> >
> > commit f8587a61892cbafd98ce599131bf4f103466f084
> > Author: H.J. Lu <hjl.tools@gmail.com>
> > Date:   Fri May 20 19:21:48 2022 -0700
> >
> >     x86-64: Ignore r_addend for R_X86_64_GLOB_DAT/R_X86_64_JUMP_SLOT
> >
> >     According to x86-64 psABI, r_addend should be ignored for
> R_X86_64_GLOB_DAT
> >     and R_X86_64_JUMP_SLOT.  Since linkers always set their r_addends to
> 0, we
> >     can ignore their r_addends.
> >
> >     Reviewed-by: Fangrui Song <maskray@google.com>
> >
> > won't ignore the r_addend value in the R_X86_64_JUMP_SLOT relocation.
>  Such
> > binaries will fail to run with these versions of glibc.  I am working
> > on a linker patch
> > to add a glibc version dependency similar to GLIBC_ABI_DT_RELR for
> DT_RELR.
> > Although this commit has been backported to glibc 2.33/2.34/2.35
> > release branches,
> > there may be 2.33/2.34/2.35 glibc binaries without the fix.
>
> Can we reuse the GLIBC_ABI_DT_RELR marker?
>

Do all versions of glibc with DT_RELR support
also ignore r_addend?

>
> > Should binaries with DT_X86_64_PLT tags depend on glibc 2.36 or 2.33?
>
> I don't understand this question.  The binaries will  run on any system
> that has the marker symbol.  Or do you suggest to use an existing glibc
> symbol version?
>

Yes, I am planning to use existing glibc symbol
version.


> Thanks,
> Florian
>

H.J.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-03  7:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-29 15:16 [RFC] DT_X86_64_PLT* dependency H.J. Lu
2023-10-02 10:26 ` Florian Weimer
2023-10-03  7:44   ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).