glibc/sysdeps/sh
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
..
be sh: Add sh4 fpu Implies folder 2020-11-27 09:29:35 -03:00
bits Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
le sh: Add sh4 fpu Implies folder 2020-11-27 09:29:35 -03:00
nofpu Add sysdeps/ieee754/soft-fp. 2017-12-12 23:35:21 +00:00
nptl elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
sh3 Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sh4 Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
____longjmp_chk.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
_mcount.S Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
abort-instr.h SH: ABORT_INSTRUCTION. 2012-06-23 11:47:39 +02:00
bsd-_setjmp.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
bsd-setjmp.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
configure rename configure.in to configure.ac 2013-10-30 17:32:08 +10:00
configure.ac rename configure.in to configure.ac 2013-10-30 17:32:08 +10:00
crti.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
crtn.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
dl-machine.h elf: Avoid nested functions in the loader [BZ #27220] 2021-10-07 11:55:02 -07:00
dl-tls.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
dl-trampoline.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
elf-initfini.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
fpu_control.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
gccframe.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
Implies Remove sysdeps/sh/soft-fp directory. 2018-05-23 20:05:31 +00:00
jmpbuf-offsets.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
jmpbuf-unwind.h Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
ldbl-classify-compat.h Move LDBL_CLASSIFY_COMPAT to its own header. 2018-02-01 21:01:00 +00:00
ldsodefs.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
libc-tls.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
libm-test-ulps sh: Update libm-tests-ulps 2021-01-28 14:05:14 -03:00
libm-test-ulps-name Do not hardcode platform names in manual/libm-err-tab.pl (bug 14139). 2016-11-04 16:49:06 +00:00
linkmap.h Rename bits/linkmap.h to linkmap.h (bug 14912). 2015-09-04 19:44:27 +00:00
machine-gmon.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
Makefile Enable unwind info in libc-start.c and backtrace.c 2017-09-19 15:07:58 +01:00
memcpy.S Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
memset.S Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
memusage.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
preconfigure sh: Split BE/LE abilist 2019-08-29 09:58:31 -03:00
preconfigure.ac sh: Split BE/LE abilist 2019-08-29 09:58:31 -03:00
sfp-machine.h Remove sysdeps/sh/soft-fp directory. 2018-05-23 20:05:31 +00:00
sotruss-lib.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
stackguard-macros.h Add SH implementation of stackguard-macros.h. 2013-09-27 10:59:02 +09:00
stackinfo.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
start.S Reduce the statically linked startup code [BZ #23323] 2021-02-25 12:13:02 +01:00
strlen.S Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
sysdep.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
tininess.h Fix strtod handling of underflow (bug 14047). 2012-10-30 13:51:27 +00:00
tst-audit.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
unwind-arch.h Implement <unwind-link.h> for dynamically loading the libgcc_s unwinder 2021-03-01 15:58:01 +01:00