glibc/sysdeps
Fangrui Song 490e6c62aa elf: Avoid nested functions in the loader [BZ #27220]
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 Clang build (Clang doesn't support GCC
nested functions).

The key idea for unnesting is to add extra parameters (struct link_map
*and struct r_scope_elm *[]) to RESOLVE_MAP,
ELF_MACHINE_BEFORE_RTLD_RELOC, ELF_DYNAMIC_RELOCATE, elf_machine_rel[a],
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 mixed extra parameters and 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, i386, x86-64, powerpc64le, powerpc64, powerpc32,
sparc64, sparcv9, s390x, s390, hppa, ia64, armhf, alpha, and mips64.
In addition, tested build-many-glibcs.py with {arc,csky,microblaze,nios2}-linux-gnu
and riscv64-linux-gnu-rv64imafdc-lp64d.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-10-07 11:55:02 -07:00
..
aarch64 elf: Avoid nested functions in the loader [BZ #27220] 2021-10-07 11:55:02 -07:00
alpha elf: Avoid nested functions in the loader [BZ #27220] 2021-10-07 11:55:02 -07:00
arc elf: Avoid nested functions in the loader [BZ #27220] 2021-10-07 11:55:02 -07:00
arm elf: Avoid nested functions in the loader [BZ #27220] 2021-10-07 11:55:02 -07:00
csky elf: Avoid nested functions in the loader [BZ #27220] 2021-10-07 11:55:02 -07:00
generic Add run-time check for indirect external access 2021-10-07 10:26:48 -07:00
gnu Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
hppa elf: Avoid nested functions in the loader [BZ #27220] 2021-10-07 11:55:02 -07:00
htl htl: Reimplement GSCOPE 2021-09-16 01:04:17 +02:00
hurd
i386 elf: Avoid nested functions in the loader [BZ #27220] 2021-10-07 11:55:02 -07:00
ia64 elf: Avoid nested functions in the loader [BZ #27220] 2021-10-07 11:55:02 -07:00
ieee754 Fixed inaccuracy of j0f (BZ #28185) 2021-10-05 13:45:37 +02:00
m68k elf: Avoid nested functions in the loader [BZ #27220] 2021-10-07 11:55:02 -07:00
mach Add fmaximum, fminimum functions 2021-09-28 23:31:35 +00:00
microblaze elf: Avoid nested functions in the loader [BZ #27220] 2021-10-07 11:55:02 -07:00
mips elf: Avoid nested functions in the loader [BZ #27220] 2021-10-07 11:55:02 -07:00
nios2 elf: Avoid nested functions in the loader [BZ #27220] 2021-10-07 11:55:02 -07:00
nptl nptl: Use FUTEX_LOCK_PI2 when available 2021-10-01 08:09:13 -03:00
posix posix: Remove spawni.c 2021-09-27 12:44:25 -03:00
powerpc elf: Avoid nested functions in the loader [BZ #27220] 2021-10-07 11:55:02 -07:00
pthread elf: Avoid deadlock between pthread_create and ctors [BZ #28357] 2021-10-04 15:07:05 +01:00
riscv elf: Avoid nested functions in the loader [BZ #27220] 2021-10-07 11:55:02 -07:00
s390 elf: Avoid nested functions in the loader [BZ #27220] 2021-10-07 11:55:02 -07:00
sh elf: Avoid nested functions in the loader [BZ #27220] 2021-10-07 11:55:02 -07:00
sparc elf: Avoid nested functions in the loader [BZ #27220] 2021-10-07 11:55:02 -07:00
unix S390: Add PCI_MIO and SIE HWCAPs 2021-10-07 06:49:39 +02:00
wordsize-32 Disable symbol hack in libc_nonshared.a 2021-09-27 07:46:25 -07:00
wordsize-64 Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
x86 Initial support for GNU_PROPERTY_1_NEEDED 2021-10-07 10:26:08 -07:00
x86_64 elf: Avoid nested functions in the loader [BZ #27220] 2021-10-07 11:55:02 -07:00