aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/i386
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/i386
parent2ce0481d26066b7d4e2c950da555a7ca20e313fb (diff)
downloadglibc-ae49f218daca0b7cab27764da4081e6509bc7345.zip
glibc-ae49f218daca0b7cab27764da4081e6509bc7345.tar.gz
glibc-ae49f218daca0b7cab27764da4081e6509bc7345.tar.bz2
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/i386')
-rw-r--r--sysdeps/i386/set-hooks-arch.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/sysdeps/i386/set-hooks-arch.h b/sysdeps/i386/set-hooks-arch.h
new file mode 100644
index 0000000..97513bf
--- /dev/null
+++ b/sysdeps/i386/set-hooks-arch.h
@@ -0,0 +1,28 @@
+/* Machine-dependent macros for using symbol sets for running lists of
+ functions. i386 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" \
+ ".long "#HOOK" - .\n" \
+ ".section .text");
+
+#endif /* set_hooks_arch.h */