linux/scripts/mod
Youling Tang 3d36f4298b LoongArch: Switch to relative exception tables
Similar to other architectures such as arm64, x86, riscv and so on, use
offsets relative to the exception table entry values rather than their
absolute addresses for both the exception location and the fixup.

However, LoongArch label difference because it will actually produce two
relocations, a pair of R_LARCH_ADD32 and R_LARCH_SUB32. Take simple code
below for example:

$ cat test_ex_table.S
.section .text
1:
        nop
.section __ex_table,"a"
        .balign 4
        .long (1b - .)
.previous

$ loongarch64-unknown-linux-gnu-gcc -c test_ex_table.S
$ loongarch64-unknown-linux-gnu-readelf -Wr test_ex_table.o

Relocation section '.rela__ex_table' at offset 0x100 contains 2 entries:
    Offset            Info             Type         Symbol's Value   Symbol's Name + Addend
0000000000000000 0000000600000032 R_LARCH_ADD32    0000000000000000  .L1^B1 + 0
0000000000000000 0000000500000037 R_LARCH_SUB32    0000000000000000  L0^A + 0

The modpost will complain the R_LARCH_SUB32 relocation, so we need to
patch modpost.c to skip this relocation for .rela__ex_table section.

Signed-off-by: Youling Tang <tangyouling@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2022-12-14 08:36:11 +08:00
..
.gitignore .gitignore: prefix local generated files with a slash 2021-05-02 00:43:35 +09:00
devicetable-offsets.c HID: intel-ish-hid: add support for MODULE_DEVICE_TABLE() 2021-11-09 11:41:46 +01:00
empty.c
file2alias.c modpost: use sym_get_data() to get module device_table data 2022-07-27 21:18:00 +09:00
list.h modpost: import include/linux/list.h 2022-05-08 03:17:00 +09:00
Makefile scripts/mod: disable LTO for empty.c 2021-01-14 08:21:09 -08:00
mk_elfconfig.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
modpost.c LoongArch: Switch to relative exception tables 2022-12-14 08:36:11 +08:00
modpost.h modpost: refactor get_secindex() 2022-08-03 22:56:46 +09:00
sumversion.c modpost: use bool type where appropriate 2022-05-08 03:17:00 +09:00