aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/x86_64
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 /sysdeps/x86_64
parent2ce0481d26066b7d4e2c950da555a7ca20e313fb (diff)
downloadglibc-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 'sysdeps/x86_64')
-rw-r--r--sysdeps/x86_64/set-hooks-arch.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/sysdeps/x86_64/set-hooks-arch.h b/sysdeps/x86_64/set-hooks-arch.h
new file mode 100644
index 0000000000..227d4f8e08
--- /dev/null
+++ b/sysdeps/x86_64/set-hooks-arch.h
@@ -0,0 +1,28 @@
+/* Machine-dependent macros for using symbol sets for running lists of
+ functions. x86-64 version.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _SET_HOOKS_ARCH_H
+#define _SET_HOOKS_ARCH_H
+
+#define SET_RELHOOK(NAME, HOOK) \
+ asm(".section " #NAME",\"aR\"\n" \
+ ".quad "#HOOK" - .\n" \
+ ".section .text");
+
+#endif /* set_hooks_arch.h */