glibc/sysdeps
Adhemerval Zanella 4af6982e4c elf: Fix elf_get_dynamic_info definition
Before to 490e6c62aa ('elf: Avoid nested functions in the loader
[BZ #27220]'), elf_get_dynamic_info() was defined twice on rtld.c: on
the first dynamic-link.h include and later within _dl_start().  The
former definition did not define DONT_USE_BOOTSTRAP_MAP and it is used
on setup_vdso() (since it is a global definition), while the former does
define DONT_USE_BOOTSTRAP_MAP and it is used on loader self-relocation.

With the commit change, the function is now included and defined once
instead of defined as a nested function.  So rtld.c defines without
defining RTLD_BOOTSTRAP and it brokes at least powerpc32.

This patch fixes by moving the get-dynamic-info.h include out of
dynamic-link.h, which then the caller can corirectly set the expected
semantic by defining STATIC_PIE_BOOTSTRAP, RTLD_BOOTSTRAP, and/or
RESOLVE_MAP.

It also required to enable some asserts only for the loader bootstrap
to avoid issues when called from setup_vdso().

As a side note, this is another issues with nested functions: it is
not clear from pre-processed output (-E -dD) how the function will
be build and its semantic (since nested function will be local and
extra C defines may change it).

I checked on x86_64-linux-gnu (w/o --enable-static-pie),
i686-linux-gnu, powerpc64-linux-gnu, powerpc-linux-gnu-power4,
aarch64-linux-gnu, arm-linux-gnu, sparc64-linux-gnu, and
s390x-linux-gnu.

Reviewed-by: Fangrui Song <maskray@google.com>
2021-10-12 13:25:43 -03: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: Fix elf_get_dynamic_info definition 2021-10-12 13:25:43 -03: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 Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
i386 elf: Fix elf_get_dynamic_info definition 2021-10-12 13:25:43 -03: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 Fix nios2 localplt failure 2021-10-11 21:47:32 +00: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 elf: Remove Intel MPX support (lazy PLT, ld.so profile, and LD_AUDIT) 2021-10-11 11:14:02 -07:00
x86_64 elf: Fix elf_get_dynamic_info definition 2021-10-12 13:25:43 -03:00