about summary refs log tree commit diff
path: root/hurd/dtable.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2021-12-28 10:27:06 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2021-12-28 10:28:22 +0100
commitae49f218daca0b7cab27764da4081e6509bc7345 (patch)
treefef5fa1b87b9bc540c84690c3128c252651f6f34 /hurd/dtable.c
parent2ce0481d26066b7d4e2c950da555a7ca20e313fb (diff)
downloadglibc-ae49f218daca0b7cab27764da4081e6509bc7345.tar.gz
glibc-ae49f218daca0b7cab27764da4081e6509bc7345.tar.xz
glibc-ae49f218daca0b7cab27764da4081e6509bc7345.zip
hurd: Fix static-PIE startup
hurd initialization stages use RUN_HOOK to run various initialization
functions.  That is however using absolute addresses which need to be
relocated, which is done later by csu.  We can however easily make the
linker compute relative addresses which thus don't need a relocation.
The new SET_RELHOOK and RUN_RELHOOK macros implement this.
Diffstat (limited to 'hurd/dtable.c')
-rw-r--r--hurd/dtable.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/hurd/dtable.c b/hurd/dtable.c
index bbd3bfc892..4f081f09fd 100644
--- a/hurd/dtable.c
+++ b/hurd/dtable.c
@@ -36,7 +36,7 @@ DEFINE_HOOK (_hurd_fd_subinit, (void));
 
 /* Initialize the file descriptor table at startup.  */
 
-static void
+static void attribute_used_retain
 init_dtable (void)
 {
   int i;
@@ -91,12 +91,10 @@ init_dtable (void)
 
   /* Run things that want to run after the file descriptor table
      is initialized.  */
-  RUN_HOOK (_hurd_fd_subinit, ());
-
-  (void) &init_dtable;		/* Avoid "defined but not used" warning.  */
+  RUN_RELHOOK (_hurd_fd_subinit, ());
 }
 
-text_set_element (_hurd_subinit, init_dtable);
+SET_RELHOOK (_hurd_subinit, init_dtable);
 
 /* XXX when the linker supports it, the following functions should all be
    elsewhere and just have text_set_elements here.  */