[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240322165233.71698-6-brgerst@gmail.com>
Date: Fri, 22 Mar 2024 12:52:22 -0400
From: Brian Gerst <brgerst@...il.com>
To: linux-kernel@...r.kernel.org,
x86@...nel.org
Cc: Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Borislav Petkov <bp@...en8.de>,
"H . Peter Anvin" <hpa@...or.com>,
Uros Bizjak <ubizjak@...il.com>,
David.Laight@...lab.com,
Brian Gerst <brgerst@...il.com>
Subject: [PATCH v4 05/16] 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@...il.com>
---
arch/x86/tools/relocs.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
index e7a44a7f617f..adf11a48ec70 100644
--- a/arch/x86/tools/relocs.c
+++ b/arch/x86/tools/relocs.c
@@ -31,6 +31,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
@@ -224,6 +229,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),
@@ -865,6 +871,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.
--
2.44.0
Powered by blists - more mailing lists