Commit ab6ce22
objtool: Handle various symbol types of rodata
In the relocation section ".rela.rodata" of each .o file compiled with
LoongArch toolchain, there are various symbol types such as STT_NOTYPE,
STT_OBJECT, STT_FUNC in addition to the usual STT_SECTION, it needs to
use reloc symbol offset instead of reloc addend to find the destination
instruction in find_jump_table() and add_jump_table().
For the most part, an absolute relocation type is used for rodata. In the
case of STT_SECTION, reloc->sym->offset is always zero, and for the other
symbol types, reloc_addend(reloc) is always zero, thus it can use a simple
statement "reloc->sym->offset + reloc_addend(reloc)" to obtain the symbol
offset for various symbol types.
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Link: https://lore.kernel.org/r/20250211115016.26913-2-yangtiezhu@loongson.cn
Acked-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>1 parent bf71940 commit ab6ce22
1 file changed
Lines changed: 11 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1954 | 1954 | | |
1955 | 1955 | | |
1956 | 1956 | | |
| 1957 | + | |
1957 | 1958 | | |
1958 | 1959 | | |
1959 | 1960 | | |
| |||
1971 | 1972 | | |
1972 | 1973 | | |
1973 | 1974 | | |
| 1975 | + | |
| 1976 | + | |
1974 | 1977 | | |
1975 | | - | |
1976 | | - | |
| 1978 | + | |
1977 | 1979 | | |
1978 | 1980 | | |
1979 | 1981 | | |
1980 | 1982 | | |
1981 | 1983 | | |
1982 | 1984 | | |
1983 | 1985 | | |
1984 | | - | |
| 1986 | + | |
1985 | 1987 | | |
1986 | 1988 | | |
1987 | | - | |
| 1989 | + | |
1988 | 1990 | | |
1989 | 1991 | | |
1990 | 1992 | | |
| |||
2023 | 2025 | | |
2024 | 2026 | | |
2025 | 2027 | | |
| 2028 | + | |
2026 | 2029 | | |
2027 | 2030 | | |
2028 | 2031 | | |
| |||
2046 | 2049 | | |
2047 | 2050 | | |
2048 | 2051 | | |
2049 | | - | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
2050 | 2056 | | |
2051 | 2057 | | |
2052 | 2058 | | |
| |||
0 commit comments