From: Ard Biesheuvel <ardb+git@google.com>
To: linux-kernel@vger.kernel.org
Cc: Ard Biesheuvel <ardb@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nsc@kernel.org>, Kees Cook <kees@kernel.org>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
linux-kbuild@vger.kernel.org, linux-hardening@vger.kernel.org,
linux-mips@vger.kernel.org
Subject: [PATCH v2 1/2] mips: Add support for PC32 relocations in vmlinux
Date: Fri, 16 Jan 2026 10:34:01 +0100 [thread overview]
Message-ID: <20260116093359.2442297-5-ardb+git@google.com> (raw)
In-Reply-To: <20260116093359.2442297-4-ardb+git@google.com>
From: Ard Biesheuvel <ardb@kernel.org>
MIPS supports PC32 relocations like most other architectures, which will
be used by kallsyms to make its symbol references visible to the linker.
Given that these are place-relative, they can be ignored by the 'relocs'
tool, just like other PC type relocations.
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
arch/mips/boot/tools/relocs.c | 2 ++
arch/mips/include/asm/elf.h | 2 ++
2 files changed, 4 insertions(+)
diff --git a/arch/mips/boot/tools/relocs.c b/arch/mips/boot/tools/relocs.c
index 9863e1d5c62e..30809f47415a 100644
--- a/arch/mips/boot/tools/relocs.c
+++ b/arch/mips/boot/tools/relocs.c
@@ -79,6 +79,7 @@ static const char *rel_type(unsigned type)
REL_TYPE(R_MIPS_HIGHEST),
REL_TYPE(R_MIPS_PC21_S2),
REL_TYPE(R_MIPS_PC26_S2),
+ REL_TYPE(R_MIPS_PC32),
#undef REL_TYPE
};
const char *name = "unknown type rel type name";
@@ -522,6 +523,7 @@ static int do_reloc(struct section *sec, Elf_Rel *rel, Elf_Sym *sym,
case R_MIPS_PC16:
case R_MIPS_PC21_S2:
case R_MIPS_PC26_S2:
+ case R_MIPS_PC32:
/*
* NONE can be ignored and PC relative relocations don't
* need to be adjusted.
diff --git a/arch/mips/include/asm/elf.h b/arch/mips/include/asm/elf.h
index dc8d2863752c..aaef0eaa68d5 100644
--- a/arch/mips/include/asm/elf.h
+++ b/arch/mips/include/asm/elf.h
@@ -123,6 +123,8 @@
#define R_MIPS_LOVENDOR 100
#define R_MIPS_HIVENDOR 127
+#define R_MIPS_PC32 248
+
#define SHN_MIPS_ACCOMON 0xff00 /* Allocated common symbols */
#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */
#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */
--
2.52.0.457.g6b5491de43-goog
next prev parent reply other threads:[~2026-01-16 9:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-16 9:34 [PATCH v2 0/2] Simplify kallsyms offset table generation Ard Biesheuvel
2026-01-16 9:34 ` Ard Biesheuvel [this message]
2026-01-16 9:34 ` [PATCH v2 2/2] kallsyms: Get rid of kallsyms relative base Ard Biesheuvel
2026-01-30 0:10 ` [PATCH v2 0/2] Simplify kallsyms offset table generation Nathan Chancellor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260116093359.2442297-5-ardb+git@google.com \
--to=ardb+git@google.com \
--cc=ardb@kernel.org \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=nsc@kernel.org \
--cc=tsbogend@alpha.franken.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox