]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Un-nest an include in dl-reloc-static-pie.c.
authorSiva Chandra Reddy <sivachandra@google.com>
Mon, 1 Apr 2019 18:26:29 +0000 (11:26 -0700)
committerFangrui Song <i@maskray.me>
Sat, 28 Aug 2021 00:26:01 +0000 (17:26 -0700)
A corresponding adjustment in sysdeps/x86_64/dl-machine.h has also been
made.

elf/dl-reloc-static-pie.c
sysdeps/x86_64/dl-machine.h

index bd2d516e5d75ae76cd8832b7946b178e15f0e328..42d1529094804bfaa280205cb07de1ceeb9926c2 100644 (file)
 #if ENABLE_STATIC_PIE
 #include <unistd.h>
 #include <ldsodefs.h>
-#include "dynamic-link.h"
+
+#ifndef NESTING
+# define STATIC_PIE_BOOTSTRAP
+# define BOOTSTRAP_MAP (main_map)
+# define RESOLVE_MAP(sym, version, flags) BOOTSTRAP_MAP
+# include "dynamic-link.h"
+#endif /* n NESTING */
 
 /* Relocate static executable with PIE.  */
 
@@ -28,10 +34,12 @@ _dl_relocate_static_pie (void)
 {
   struct link_map *main_map = _dl_get_dl_main_map ();
 
+#ifdef NESTING
 # define STATIC_PIE_BOOTSTRAP
 # define BOOTSTRAP_MAP (main_map)
 # define RESOLVE_MAP(sym, version, flags) BOOTSTRAP_MAP
 # include "dynamic-link.h"
+#endif /* NESTING */
 
   /* Figure out the run-time load address of static PIE.  */
   main_map->l_addr = elf_machine_load_address ();
@@ -46,7 +54,11 @@ _dl_relocate_static_pie (void)
 
   /* Relocate ourselves so we can do normal function calls and
      data access using the global offset table.  */
-  ELF_DYNAMIC_RELOCATE (main_map, 0, 0, 0);
+  ELF_DYNAMIC_RELOCATE (main_map, 0, 0, 0
+#ifndef NESTING
+                        , main_map
+#endif
+                        );
   main_map->l_relocated = 1;
 }
 #endif
index ea9a2366b2c2782c1a388c7e0fb5913d1257550a..f2b80df619fbf1d699ca700f07ff535749ca538c 100644 (file)
@@ -309,7 +309,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
 # ifndef RTLD_BOOTSTRAP
       const ElfW(Sym) *const refsym = sym;
 # endif
-#if !defined NESTING && defined RTLD_BOOTSTRAP
+#if !defined NESTING && (defined RTLD_BOOTSTRAP || defined STATIC_PIE_BOOTSTRAP)
   struct link_map *sym_map = boot_map;
 #else
       struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);