public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v6 0/5] Support DT_RELR relative relocation format
@ 2022-03-10 20:03 H.J. Lu
  2022-03-10 20:03 ` [PATCH v6 1/5] elf: Support DT_RELR relative relocation format [BZ #27924] H.J. Lu
                   ` (5 more replies)
  0 siblings, 6 replies; 27+ messages in thread
From: H.J. Lu @ 2022-03-10 20:03 UTC (permalink / raw)
  To: libc-alpha; +Cc: Fangrui Song, Joseph Myers

Changes in v6:

1. Move ELF_DYNAMIC_DO_RELR before ELF_DYNAMIC_DO_REL.

Changes in v5:

1. Update NEWS entry with the linker option, -z pack-relative-relocs.
2. Remove elf/libc-abi-version.exp and use $(READELF) to check
GLIBC_ABI_DT_RELR.

Changes in v4:

1. Always enable GLIBC_ABI_DT_RELR check.
2. Use $(OBJDUMP) instead of $(NM) for GLIBC_ABI_DT_RELR check. 

Changes in v3:

1. Don't define SUPPORT_DT_RELR.
2. Enable DT_RELR in glibc shared libraries and position independent
executables (PIE) automatically if linker supports -z pack-relative-relocs.

Changes in v2:

1. Enable DT_RELR for all targets.
2. Issue an error if there is a DT_RELR entry without GLIBC_ABI_DT_RELR
dependency nor GLIBC_PRIVATE definition.

---
PIE and shared objects usually have many relative relocations. In
2017/2018, SHT_RELR/DT_RELR was proposed on
https://groups.google.com/g/generic-abi/c/bX460iggiKg/m/GxjM0L-PBAAJ
("Proposal for a new section type SHT_RELR") and is a pre-standard. RELR
usually takes 3% or smaller space than R_*_RELATIVE relocations. The
virtual memory size of a mostly statically linked PIE is typically 5~10%
smaller.

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.  Issue an error if there is a
DT_RELR entry without GLIBC_ABI_DT_RELR dependency nor GLIBC_PRIVATE
definition.

DT_RELR is enabled in glibc shared libraries and position independent
executables (PIE) automatically if linker supports -z pack-relative-relocs.

The DT_RELR usage in glibc can be disabled with --disable-default-dt-relr.

Tested with binutils 2.38 on i686, x86-64 and x32.

Fangrui Song (1):
  elf: Support DT_RELR relative relocation format [BZ #27924]

H.J. Lu (4):
  elf: Properly handle zero DT_RELA/DT_REL values
  Add GLIBC_ABI_DT_RELR for DT_RELR support
  Add --disable-default-dt-relr
  NEWS: Mention DT_RELR support

 INSTALL                |  6 ++++
 Makeconfig             | 19 +++++++++++++
 Makerules              |  2 ++
 NEWS                   |  3 +-
 configure              | 60 +++++++++++++++++++++++++++++++++++++++
 configure.ac           | 23 +++++++++++++++
 elf/Makefile           | 30 ++++++++++++++++++--
 elf/Versions           |  5 ++++
 elf/dl-version.c       | 33 ++++++++++++++++++++--
 elf/dynamic-link.h     | 40 +++++++++++++++++++++++++-
 elf/elf.h              | 13 +++++++--
 elf/get-dynamic-info.h | 19 +++++++++++--
 elf/tst-relr-pie.c     |  1 +
 elf/tst-relr.c         | 64 ++++++++++++++++++++++++++++++++++++++++++
 include/link.h         |  6 ++++
 manual/install.texi    |  5 ++++
 scripts/abilist.awk    |  2 ++
 scripts/versions.awk   |  7 ++++-
 18 files changed, 325 insertions(+), 13 deletions(-)
 create mode 100644 elf/tst-relr-pie.c
 create mode 100644 elf/tst-relr.c

-- 
2.35.1


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

end of thread, other threads:[~2022-03-30 21:32 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-10 20:03 [PATCH v6 0/5] Support DT_RELR relative relocation format H.J. Lu
2022-03-10 20:03 ` [PATCH v6 1/5] elf: Support DT_RELR relative relocation format [BZ #27924] H.J. Lu
2022-03-29 16:34   ` Adhemerval Zanella
2022-03-29 22:34     ` H.J. Lu
2022-03-10 20:03 ` [PATCH v6 2/5] elf: Properly handle zero DT_RELA/DT_REL values H.J. Lu
2022-03-29 16:38   ` Adhemerval Zanella
2022-03-29 22:30     ` H.J. Lu
2022-03-10 20:03 ` [PATCH v6 3/5] Add GLIBC_ABI_DT_RELR for DT_RELR support H.J. Lu
2022-03-29 16:52   ` Adhemerval Zanella
2022-03-29 22:29     ` H.J. Lu
2022-03-30 14:18       ` Adhemerval Zanella
2022-03-30 14:41         ` H.J. Lu
2022-03-30 17:17           ` Adhemerval Zanella
2022-03-30 17:32             ` H.J. Lu
2022-03-30 17:39               ` Adhemerval Zanella
2022-03-30 19:22             ` Joseph Myers
2022-03-30 20:38               ` Adhemerval Zanella
2022-03-30 21:32                 ` Fangrui Song
2022-03-10 20:03 ` [PATCH v6 4/5] Add --disable-default-dt-relr H.J. Lu
2022-03-29 17:19   ` Adhemerval Zanella
2022-03-29 22:25     ` H.J. Lu
2022-03-10 20:03 ` [PATCH v6 5/5] NEWS: Mention DT_RELR support H.J. Lu
2022-03-29 17:25   ` Adhemerval Zanella
2022-03-29 22:22     ` H.J. Lu
2022-03-29 23:34       ` Fangrui Song
2022-03-30 14:20         ` Adhemerval Zanella
2022-03-10 20:09 ` [PATCH v6 0/5] Support DT_RELR relative relocation format Fangrui Song

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).