[PATCH 3/7] Add GLIBC_ABI_DT_RELR for DT_RELR support

H.J. Lu hjl.tools@gmail.com
Fri Feb 4 20:40:28 GMT 2022


On Fri, Feb 4, 2022 at 12:11 PM Joseph Myers <joseph@codesourcery.com> wrote:
>
> On Fri, 4 Feb 2022, H.J. Lu via Libc-alpha wrote:
>
> > In my cover letter, I said
> >
> > Binutils 2.38 supports DT_RELR on x86 with the -z report-relative-reloc
> > option.  When DT_RELR is enabled, ld adds a GLIBC_ABI_DT_RELR symbol
> > version dependency on libc.so to outputs.  The DT_RELR support is enabled
> > in ld.so only if the linker supports -z report-relative-reloc option.
> >
> > and the first patch has
> >
> >  # define ELF_DYNAMIC_RELOCATE(map, scope, lazy, consider_profile, skip_ifunc) \
> >    do {       \
> >      int edr_lazy = elf_machine_runtime_setup ((map), (scope), (lazy),       \
> >         (consider_profile));       \
> >      ELF_DYNAMIC_DO_REL ((map), (scope), edr_lazy, skip_ifunc);       \
> >      ELF_DYNAMIC_DO_RELA ((map), (scope), edr_lazy, skip_ifunc);
> >       \
> > +    if (HAVE_DT_RELR && ((map) != &GL(dl_rtld_map) || DO_RTLD_BOOTSTRAP))     \
> > +      ELF_DYNAMIC_DO_RELR (map);       \
> >    } while (0)
> >
> > If HAVE_DT_RELR is 0, DT_RELR is disabled.
>
> It's important that glibc 2.36 supports the same executables and shared
> libraries on a given platform, independent of the binutils version used to
> build glibc.  If any build of glibc 2.36 for some platform supports RELR
> relocations, all builds of it for that platform must support such
> relocations.
>
> That means that configure tests for linker support can *only* affect
> whether glibc is built to *use* such relocations itself - not whether it
> supports loading executables and shared libraries that use them.
>
> (You could also increase the minimum linker version for building glibc for
> a given platform, but the RELR support is too recent for it to be a good
> idea to make the minimum version new enough to include RELR support.)

Good point.  How about "enable DT_RELR only if SUPPORT_DT_RELR is
defined?  Currently, only x86 defines SUPPORT_DT_RELR.

-- 
H.J.


More information about the Libc-alpha mailing list