diff options
author | Fangrui Song <maskray@google.com> | 2021-09-24 13:44:48 -0700 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2021-09-24 13:44:48 -0700 |
commit | 23381aebf2576115acac23690af6081544fc80eb (patch) | |
tree | 12b19a2907794d5833cff7818792c5d49effef0a /elf/gen-trusted-dirs.awk | |
parent | 4ae2b8a42338f6adba7817539d05ad347154cda3 (diff) | |
download | glibc-23381aebf2576115acac23690af6081544fc80eb.tar.gz |
elf: Avoid nested functions in the loader (all ports) [BZ #27220]maskray/unnest
[Alternative to https://sourceware.org/pipermail/libc-alpha/2021-August/130340.html
This version fixes all ports and doesn't add NESTING dispatches.]
[Available at
https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/maskray/unnest ]
dynamic-link.h is included more than once in some elf/ files (rtld.c,
dl-conflict.c, dl-reloc.c, dl-reloc-static-pie.c) and uses GCC nested
functions. This harms readability and the nested functions usage
is the biggest obstacle prevents CC=clang (which doesn't support the
feature).
The key idea for unnesting is to add extra parameters (link_map * and
r_scope_elm *[]) to RESOLVE_MAP, ELF_MACHINE_BEFORE_RTLD_RELOC,
ELF_DYNAMIC_RELOCATE, elf_machine_rela?, elf_machine_lazy_rel, and
elf_machine_runtime_setup. (This is inspired by Stan Shebs' ppc64/x86-64
implementation in the google/grte/v5-2.27/master which uses static
variables.)
Future simplification:
* If mips elf_machine_runtime_setup no longer needs RESOLVE_GOTSYM,
elf_machine_runtime_setup can drop the `scope` parameter.
* If TLSDESC no longer need to be in elf_machine_lazy_rel,
elf_machine_lazy_rel can drop the `scope` parameter.
Tested on aarch64-linux-gnu, powerpc64le-linux-gnu and x86_64-linux-gnu.
Tested build-many-glibcs.py glibcs with
{alpha,arc,csky,hppa,ia64,microblaze,nios2,s390x,sh4,sparc64,sparc64}-linux-gnu,
arm-linux-gnueabi, csky-linux-gnuabiv2, mips64-linux-gnu-n64, and riscv64-linux-gnu-rv64imafdc-lp64.
Diffstat (limited to 'elf/gen-trusted-dirs.awk')
0 files changed, 0 insertions, 0 deletions