s390/tools/relocs: Ignore __kcfi_typeid_ relocations

This is the s390 variant of commit ca7e10bff1 ("x86/tools/relocs: Ignore
__kcfi_typeid_ relocations"):

"The compiler generates __kcfi_typeid_ symbols for annotating assembly
functions with type information. These are constants that can be referenced
in assembly code and are resolved by the linker. Ignore them in relocs."

Reviewed-by: Jens Remus <jremus@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
This commit is contained in:
Heiko Carstens
2026-07-27 16:05:09 +02:00
committed by Vasily Gorbik
parent accfabc3af
commit 1ccbfc99ce

View File

@@ -405,6 +405,22 @@ static int do_reloc(struct section *sec, Elf_Rel *rel, ElfW(Sym) *sym,
case R_390_GOTPCDBL:
case R_390_GOTOFF64:
break;
case R_390_32: {
static const char kcfipfx[] = "__kcfi_typeid_";
if (sym->st_shndx != SHN_ABS)
die("Unsupported relocation type: %d\n", r_type);
/*
* Symbols with __kcfi_typeid_ prefix have constant values,
* which do not change if bzImage is loaded at a different
* physical address than the address for which it has been
* compiled.
*/
if (!strncmp(kcfipfx, symname, sizeof(kcfipfx) - 1))
break;
die("Invalid absolute R_390_32 relocation: %s\n", symname);
break;
}
case R_390_64:
add_reloc(&relocs64, offset);
break;