about summary refs log tree commit diff
path: root/hurd/hurdpid.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/hurdpid.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/hurdpid.c')
-rw-r--r--hurd/hurdpid.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/hurd/hurdpid.c b/hurd/hurdpid.c
index 9014de58e9..613ca357c6 100644
--- a/hurd/hurdpid.c
+++ b/hurd/hurdpid.c
@@ -17,11 +17,12 @@
 
 #include <hurd.h>
 #include <lowlevellock.h>
+#include "set-hooks.h"
 
 pid_t _hurd_pid, _hurd_ppid, _hurd_pgrp;
 int _hurd_orphaned;
 
-static void
+static void attribute_used_retain
 init_pids (void)
 {
   __USEPORT (PROC,
@@ -29,11 +30,9 @@ init_pids (void)
 	       __proc_getpids (port, &_hurd_pid, &_hurd_ppid, &_hurd_orphaned);
 	       __proc_getpgrp (port, _hurd_pid, &_hurd_pgrp);
 	     }));
-
-  (void) &init_pids;		/* Avoid "defined but not used" warning.  */
 }
 
-text_set_element (_hurd_proc_subinit, init_pids);
+SET_RELHOOK (_hurd_proc_subinit, init_pids);
 
 #include <hurd/msg_server.h>
 #include "set-hooks.h"