diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2021-12-28 10:27:06 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2021-12-28 10:28:22 +0100 |
commit | ae49f218daca0b7cab27764da4081e6509bc7345 (patch) | |
tree | fef5fa1b87b9bc540c84690c3128c252651f6f34 /hurd/hurdmalloc.c | |
parent | 2ce0481d26066b7d4e2c950da555a7ca20e313fb (diff) | |
download | glibc-ae49f218daca0b7cab27764da4081e6509bc7345.tar glibc-ae49f218daca0b7cab27764da4081e6509bc7345.tar.gz glibc-ae49f218daca0b7cab27764da4081e6509bc7345.tar.bz2 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/hurdmalloc.c')
-rw-r--r-- | hurd/hurdmalloc.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/hurd/hurdmalloc.c b/hurd/hurdmalloc.c index 7046bcef33..ccb8fc8b54 100644 --- a/hurd/hurdmalloc.c +++ b/hurd/hurdmalloc.c @@ -1,5 +1,6 @@ #include <stdlib.h> #include <string.h> +#include "set-hooks.h" #include "hurdmalloc.h" /* XXX see that file */ @@ -148,7 +149,7 @@ static struct free_list malloc_free_list[NBUCKETS]; It preserves the values of data variables like malloc_free_list, but does not save the vm_allocate'd space allocated by this malloc. */ -static void +static void attribute_used_retain malloc_init (void) { int i; @@ -160,11 +161,6 @@ malloc_init (void) malloc_free_list[i].in_use = 0; #endif } - - /* This not only suppresses a `defined but not used' warning, - but it is ABSOLUTELY NECESSARY to avoid the hyperclever - compiler from "optimizing out" the entire function! */ - (void) &malloc_init; } static void @@ -445,4 +441,4 @@ _hurd_malloc_fork_child(void) } -text_set_element (_hurd_preinit_hook, malloc_init); +SET_RELHOOK (_hurd_preinit_hook, malloc_init); |