[PATCH 3/7] Add GLIBC_ABI_DT_RELR for DT_RELR support

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


On Fri, Feb 4, 2022 at 11:53 AM Joseph Myers <joseph@codesourcery.com> wrote:
>
> On Thu, 3 Feb 2022, H.J. Lu via Libc-alpha wrote:
>
> > +%if HAVE_DT_RELR
> > +  GLIBC_ABI_DT_RELR {
> > +    # This symbol is used only for empty version map and will be removed
> > +    # by scripts/versions.awk.
> > +    __placeholder_only_for_empty_version_map;
> > +  }
>
> My understanding is that HAVE_DT_RELR describes a property of the linker
> used to build glibc, not a property of what features glibc itself
> supports.
>
> The symbol versions provided by glibc, and whether glibc supports binaries
> using RELR relocations, should be independent of whether the linker
> version used to build glibc supports such relocations.  A given glibc
> version should either always support RELR relocations (for a given glibc
> ABI) or never support them (for that ABI), independent of linker features,
> and likewise the symbol versions provided by glibc should be independent
> of linker features.
>

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.

-- 
H.J.


More information about the Libc-alpha mailing list