about summary refs log tree commit diff
path: root/hurd/hurdid.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/hurdid.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/hurdid.c')
-rw-r--r--hurd/hurdid.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/hurd/hurdid.c b/hurd/hurdid.c
index 70c46c0740..b220532c35 100644
--- a/hurd/hurdid.c
+++ b/hurd/hurdid.c
@@ -17,6 +17,7 @@
 
 #include <hurd.h>
 #include <hurd/id.h>
+#include "set-hooks.h"
 
 struct hurd_id_data _hurd_id;
 
@@ -74,7 +75,7 @@ _hurd_check_ids (void)
   return 0;
 }
 
-static void
+static void attribute_used_retain
 init_id (void)
 {
   __mutex_init (&_hurd_id.lock);
@@ -84,7 +85,5 @@ init_id (void)
   _hurd_id.gen.nuids = _hurd_id.aux.nuids = 0;
   _hurd_id.gen.gids = _hurd_id.aux.gids = NULL;
   _hurd_id.gen.ngids = _hurd_id.aux.ngids = 0;
-
-  (void) &init_id;		/* Avoid "defined but not used" warning.  */
 }
-text_set_element (_hurd_preinit_hook, init_id);
+SET_RELHOOK (_hurd_preinit_hook, init_id);