summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Gerst <brgerst@gmail.com>2025-01-23 22:07:37 +0300
committerIngo Molnar <mingo@kernel.org>2025-02-18 12:15:02 +0300
commitcb7927fda002ca49ae62e2782c1692acc7b80c67 (patch)
treea4fec875e219d021be8c6846c84cd39e7aa2112c
parentf58b63857ae38b4484185b799a2759274b930c92 (diff)
downloadlinux-cb7927fda002ca49ae62e2782c1692acc7b80c67.tar.xz
x86/relocs: Handle R_X86_64_REX_GOTPCRELX relocations
Clang may produce R_X86_64_REX_GOTPCRELX relocations when redefining the stack protector location. Treat them as another type of PC-relative relocation. Signed-off-by: Brian Gerst <brgerst@gmail.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: https://lore.kernel.org/r/20250123190747.745588-6-brgerst@gmail.com
-rw-r--r--arch/x86/tools/relocs.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
index e937be979ec8..92a1e503305e 100644
--- a/arch/x86/tools/relocs.c
+++ b/arch/x86/tools/relocs.c
@@ -32,6 +32,11 @@ static struct relocs relocs32;
static struct relocs relocs32neg;
static struct relocs relocs64;
# define FMT PRIu64
+
+#ifndef R_X86_64_REX_GOTPCRELX
+# define R_X86_64_REX_GOTPCRELX 42
+#endif
+
#else
# define FMT PRIu32
#endif
@@ -227,6 +232,7 @@ static const char *rel_type(unsigned type)
REL_TYPE(R_X86_64_PC16),
REL_TYPE(R_X86_64_8),
REL_TYPE(R_X86_64_PC8),
+ REL_TYPE(R_X86_64_REX_GOTPCRELX),
#else
REL_TYPE(R_386_NONE),
REL_TYPE(R_386_32),
@@ -861,6 +867,7 @@ static int do_reloc64(struct section *sec, Elf_Rel *rel, ElfW(Sym) *sym,
case R_X86_64_PC32:
case R_X86_64_PLT32:
+ case R_X86_64_REX_GOTPCRELX:
/*
* PC relative relocations don't need to be adjusted unless
* referencing a percpu symbol.