From 5118dcac68c4eadfd6304bb33adde63d062dc07f Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Fri, 15 Oct 2021 14:35:31 -0300 Subject: elf: Fix elf_get_dynamic_info() for bootstrap THe d6d89608ac8c broke powerpc for --enable-bind-now because it turned out that different than patch assumption rtld elf_get_dynamic_info() does require to handle RTLD_BOOTSTRAP to avoid DT_FLAGS and DT_RUNPATH (more specially the GLRO usage which is not reallocate yet). This patch fixes by passing two arguments to elf_get_dynamic_info() to inform that by rtld (bootstrap) or static pie initialization (static_pie_bootstrap). I think using explicit argument is way more clear and burried C preprocessor, and compiler should remove the dead code. I checked on x86_64 and i686 with default options, --enable-bind-now, and --enable-bind-now and --enable--static-pie. I also check on aarch64, armhf, powerpc64, and powerpc with default and --enable-bind-now. --- elf/rtld.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'elf/rtld.c') diff --git a/elf/rtld.c b/elf/rtld.c index 6cfb7cf672..c66a1d00bc 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -547,7 +547,7 @@ _dl_start (void *arg) /* Read our own dynamic section and fill in the info array. */ bootstrap_map.l_ld = (void *) bootstrap_map.l_addr + elf_machine_dynamic (); - elf_get_dynamic_info (&bootstrap_map); + elf_get_dynamic_info (&bootstrap_map, true, false); #if NO_TLS_OFFSET != 0 bootstrap_map.l_tls_offset = NO_TLS_OFFSET; @@ -1615,7 +1615,7 @@ dl_main (const ElfW(Phdr) *phdr, if (! rtld_is_main) { /* Extract the contents of the dynamic section for easy access. */ - elf_get_dynamic_info (main_map); + elf_get_dynamic_info (main_map, false, false); /* If the main map is libc.so, update the base namespace to refer to this map. If libc.so is loaded later, this happens -- cgit 1.4.1