about summary refs log tree commit diff
path: root/hurd/hurdrlimit.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/hurdrlimit.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/hurdrlimit.c')
-rw-r--r--hurd/hurdrlimit.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/hurd/hurdrlimit.c b/hurd/hurdrlimit.c
index 17535c2851..4d16bd4f3f 100644
--- a/hurd/hurdrlimit.c
+++ b/hurd/hurdrlimit.c
@@ -19,6 +19,7 @@
 #include <hurd.h>
 #include <lock-intern.h>
 #include <hurd/resource.h>
+#include "set-hooks.h"
 
 /* This must be given an initializer, or the a.out linking rules will
    not include the entire file when this symbol is referenced. */
@@ -29,7 +30,7 @@ struct rlimit _hurd_rlimits[RLIM_NLIMITS] = { { 0, }, };
    mutex_init is still required below just in case of unexec.  */
 struct mutex _hurd_rlimit_lock = { SPIN_LOCK_INITIALIZER, };
 
-static void
+static void attribute_used_retain
 init_rlimit (void)
 {
   int i;
@@ -52,7 +53,5 @@ init_rlimit (void)
 	  }
 #undef	I
     }
-
-  (void) &init_rlimit;
 }
-text_set_element (_hurd_preinit_hook, init_rlimit);
+SET_RELHOOK (_hurd_preinit_hook, init_rlimit);