Message ID | 20220203180948.2744-1-hjl.tools@gmail.com |
---|---|
Headers | show |
Series | Support DT_RELR relative relocation format | expand |
On Thu, 3 Feb 2022, H.J. Lu via Libc-alpha wrote: > DT_RELR is enabled in glibc shared libraries and position independent > executables (PIE) automatically if linker supports -z pack-relative-relocs > nd the architecture defines SUPPORT_DT_RELR in config.h. At the moment, > only x86 targets define SUPPORT_DT_RELR. The patch 1 description says "This patch is simpler than Chrome OS's glibc patch and makes ELF_DYNAMIC_DO_RELR available to all ports.". What exactly would other architectures need to add in glibc to provide RELR support, since I don't see any actual architecture-specific code in this patch series outside of configure scripts? Please provide text you would propose to add to https://sourceware.org/glibc/wiki/PortStatus that gives an architecture maintainer all the information needed to add such support for their architecture. If in fact no architecture-specific code should be needed, please remove the SUPPORT_DT_RELR handling and just allow glibc to support the feature for all architectures (while using RELR in glibc itself for architectures where the linker support is present, as detected by a configure test on the linker rather than hardcoding information about which architectures have that linker support at a given time). The default should be to support a feature for all architectures. A patch series supporting a feature for only some architectures needs a positive reason for excluding other architectures (for example, that each architecture needs architecture-specific code, for which you provide suitable documentation to add to PortStatus to help architecture maintainers in writing such code).
On Fri, Feb 4, 2022 at 12:00 PM Joseph Myers <joseph@codesourcery.com> wrote: > > On Thu, 3 Feb 2022, H.J. Lu via Libc-alpha wrote: > > > DT_RELR is enabled in glibc shared libraries and position independent > > executables (PIE) automatically if linker supports -z pack-relative-relocs > > nd the architecture defines SUPPORT_DT_RELR in config.h. At the moment, > > only x86 targets define SUPPORT_DT_RELR. > > The patch 1 description says "This patch is simpler than Chrome OS's glibc > patch and makes ELF_DYNAMIC_DO_RELR available to all ports.". > > What exactly would other architectures need to add in glibc to provide > RELR support, since I don't see any actual architecture-specific code in DT_RELR is enabled only if linker supports -z report-relative-reloc option which adds GLIBC_ABI_DT_RELR dependency in the linker output to prevent random crashes with the older glibc binaries. > this patch series outside of configure scripts? Please provide text you > would propose to add to https://sourceware.org/glibc/wiki/PortStatus that > gives an architecture maintainer all the information needed to add such > support for their architecture. If in fact no architecture-specific code > should be needed, please remove the SUPPORT_DT_RELR handling and just > allow glibc to support the feature for all architectures (while using RELR > in glibc itself for architectures where the linker support is present, as > detected by a configure test on the linker rather than hardcoding > information about which architectures have that linker support at a given > time). > > The default should be to support a feature for all architectures. A patch > series supporting a feature for only some architectures needs a positive > reason for excluding other architectures (for example, that each > architecture needs architecture-specific code, for which you provide > suitable documentation to add to PortStatus to help architecture > maintainers in writing such code). > > -- > Joseph S. Myers > joseph@codesourcery.com
On Fri, 4 Feb 2022, H.J. Lu via Libc-alpha wrote: > On Fri, Feb 4, 2022 at 12:00 PM Joseph Myers <joseph@codesourcery.com> wrote: > > > > On Thu, 3 Feb 2022, H.J. Lu via Libc-alpha wrote: > > > > > DT_RELR is enabled in glibc shared libraries and position independent > > > executables (PIE) automatically if linker supports -z pack-relative-relocs > > > nd the architecture defines SUPPORT_DT_RELR in config.h. At the moment, > > > only x86 targets define SUPPORT_DT_RELR. > > > > The patch 1 description says "This patch is simpler than Chrome OS's glibc > > patch and makes ELF_DYNAMIC_DO_RELR available to all ports.". > > > > What exactly would other architectures need to add in glibc to provide > > RELR support, since I don't see any actual architecture-specific code in > > DT_RELR is enabled only if linker supports -z report-relative-reloc option > which adds GLIBC_ABI_DT_RELR dependency in the linker output to > prevent random crashes with the older glibc binaries. What do you mean by "is enabled"? Building glibc itself to use such relocations can properly depend on linker support. The set of binaries (executables and shared libraries) glibc can load must not depend on linker support. Those are two different questions.
On 2022-02-04, Joseph Myers wrote: >On Thu, 3 Feb 2022, H.J. Lu via Libc-alpha wrote: > >> DT_RELR is enabled in glibc shared libraries and position independent >> executables (PIE) automatically if linker supports -z pack-relative-relocs >> nd the architecture defines SUPPORT_DT_RELR in config.h. At the moment, >> only x86 targets define SUPPORT_DT_RELR. > >The patch 1 description says "This patch is simpler than Chrome OS's glibc >patch and makes ELF_DYNAMIC_DO_RELR available to all ports.". > >What exactly would other architectures need to add in glibc to provide >RELR support, since I don't see any actual architecture-specific code in >this patch series outside of configure scripts? Please provide text you >would propose to add to https://sourceware.org/glibc/wiki/PortStatus that >gives an architecture maintainer all the information needed to add such >support for their architecture. If in fact no architecture-specific code >should be needed, please remove the SUPPORT_DT_RELR handling and just >allow glibc to support the feature for all architectures (while using RELR >in glibc itself for architectures where the linker support is present, as >detected by a configure test on the linker rather than hardcoding >information about which architectures have that linker support at a given >time). > >The default should be to support a feature for all architectures. A patch >series supporting a feature for only some architectures needs a positive >reason for excluding other architectures (for example, that each >architecture needs architecture-specific code, for which you provide >suitable documentation to add to PortStatus to help architecture >maintainers in writing such code). The patch series mix two things. "elf: Support DT_RELR relative relocation format [BZ #27924]" allows user programs to use DT_RELR. This is the main benefit. AIUI the other patches are to allow x86-64 libc.so.6 to be built with DT_RELR. This is more for dogfooding purposes and helps binutils port maintainers confirm their ld.bfd support handles some uncommon cases (glibc shared objects). The second part needs a https://sourceware.org/glibc/wiki/PortStatus entry. --- (Personally I'd prefer separate patches. But with some frustration on https://sourceware.org/pipermail/libc-alpha/2021-November/133009.html I don't care in what form glibc will get DT_RELR support... and I really appreciate that H.J contributed the ld.bfd support and drives this glibc effort. )