local-dlfptr
authorGNU Libc Maintainers <debian-glibc@lists.debian.org>
Sun, 28 May 2017 17:29:33 +0000 (17:29 +0000)
committerAurelien Jarno <aurel32@debian.org>
Sun, 28 May 2017 17:29:33 +0000 (17:29 +0000)
Gbp-Pq: Topic any
Gbp-Pq: Name local-dlfptr.diff

elf/dl-fptr.c
sysdeps/generic/dl-fptr.h

index 1eb360faad14518305eac7eccb451056c66cd5ed..a104c07c8e565b72029cfb783db455cb679c61b8 100644 (file)
@@ -56,7 +56,12 @@ static struct local
   }
 local =
   {
+#ifndef SHARED
     .root = &local.boot_table,
+#else
+    /* Address of .boot_table is not known until runtime.  */
+    .root = 0,
+#endif
     .npages = 2,
     .boot_table =
       {
@@ -93,6 +98,17 @@ new_fdesc_table (struct local *l, size_t *size)
   return new_table;
 }
 
+/* Must call _dl_fptr_init before using any other function.  */
+void
+_dl_fptr_init (void)
+{
+  struct local *l;
+
+  ELF_MACHINE_LOAD_ADDRESS (l, local);
+  /* Initialize root once.  */
+  if (__builtin_expect (l->root == 0, 0))
+    l->root = &l->boot_table;
+}
 
 static ElfW(Addr)
 make_fdesc (ElfW(Addr) ip, ElfW(Addr) gp)
index df0abba642328a2f7a5d920704bf26a12fb14b48..21a47fb9755c42a506bd8ff8daa598f6f1fdf176 100644 (file)
@@ -39,6 +39,9 @@ struct link_map;
 
 extern ElfW(Addr) _dl_boot_fptr_table [];
 
+/* Must be called before any other function.  */
+extern void _dl_fptr_init (void);
+
 extern ElfW(Addr) _dl_make_fptr (struct link_map *, const ElfW(Sym) *,
                                 ElfW(Addr));