modpost: error out if addend_*_rel() is not implemented for REL arch
authorMasahiro Yamada <masahiroy@kernel.org>
Thu, 11 May 2023 16:24:22 +0000 (01:24 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Mon, 22 May 2023 01:34:38 +0000 (10:34 +0900)
The section mismatch check relies on the relocation entries.

For REL, the addend value is implicit, so we need some code to compute
it. Currently, EM_386, EM_ARM, and EM_MIPS are supported. This commit
makes sure we covered all the cases.

I believe the other architectures use RELA, where the explicit r_addend
field exists.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
scripts/mod/modpost.c

index d4531d0..c1c523a 100644 (file)
@@ -1628,6 +1628,8 @@ static void section_rel(const char *modname, struct elf_info *elf,
                        if (addend_mips_rel(elf, sechdr, &r))
                                continue;
                        break;
+               default:
+                       fatal("Please add code to calculate addend for this architecture\n");
                }
                sym = elf->symtab_start + r_sym;
                /* Skip special sections */