]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mips: Add support for PC32 relocations in vmlinux
authorArd Biesheuvel <ardb@kernel.org>
Fri, 16 Jan 2026 09:34:01 +0000 (10:34 +0100)
committerNathan Chancellor <nathan@kernel.org>
Thu, 22 Jan 2026 22:58:17 +0000 (15:58 -0700)
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>
arch/mips/boot/tools/relocs.c
arch/mips/include/asm/elf.h

index 9863e1d5c62e3dea3a42dbea150debc401fb2d9c..30809f47415a40b98cc589bae1472c5c82bb7951 100644 (file)
@@ -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.
index dc8d2863752cfd5e8e2cbd750276f9463e0c32b8..aaef0eaa68d5521f39662c60fe6dd5c084cb04be 100644 (file)
 #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.  */