Skip to content

Commit ff79d31

Browse files
ardbiesheuvelnathanchance
authored andcommitted
mips: Add support for PC32 relocations in vmlinux
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. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Link: https://patch.msgid.link/20260116093359.2442297-5-ardb+git@google.com Signed-off-by: Nathan Chancellor <nathan@kernel.org>
1 parent 6eac13c commit ff79d31

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

arch/mips/boot/tools/relocs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ static const char *rel_type(unsigned type)
7979
REL_TYPE(R_MIPS_HIGHEST),
8080
REL_TYPE(R_MIPS_PC21_S2),
8181
REL_TYPE(R_MIPS_PC26_S2),
82+
REL_TYPE(R_MIPS_PC32),
8283
#undef REL_TYPE
8384
};
8485
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,
522523
case R_MIPS_PC16:
523524
case R_MIPS_PC21_S2:
524525
case R_MIPS_PC26_S2:
526+
case R_MIPS_PC32:
525527
/*
526528
* NONE can be ignored and PC relative relocations don't
527529
* need to be adjusted.

arch/mips/include/asm/elf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@
123123
#define R_MIPS_LOVENDOR 100
124124
#define R_MIPS_HIVENDOR 127
125125

126+
#define R_MIPS_PC32 248
127+
126128
#define SHN_MIPS_ACCOMON 0xff00 /* Allocated common symbols */
127129
#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */
128130
#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */

0 commit comments

Comments
 (0)