linux/tools/objtool
Tiezhu Yang e91c5e4c21 objtool: Check local label in read_unwind_hints()
When update the latest upstream gcc and binutils, it generates some
objtool warnings on LoongArch, like this:

  arch/loongarch/kernel/entry.o: warning: objtool: ret_from_fork+0x0: unreachable instruction

We can see that the reloc sym name is local label instead of section
in relocation section '.rela.discard.unwind_hints', in this case, the
reloc sym type is STT_NOTYPE instead of STT_SECTION. Let us check it
to not return -1, then use reloc->sym->offset instead of reloc addend
which is 0 to find the corresponding instruction.

Here are some detailed info:
[fedora@linux 6.8.test]$ gcc --version
gcc (GCC) 14.0.1 20240129 (experimental)
[fedora@linux 6.8.test]$ as --version
GNU assembler (GNU Binutils) 2.42.50.20240129
[fedora@linux 6.8.test]$ readelf -r arch/loongarch/kernel/entry.o | grep -A 3 "rela.discard.unwind_hints"
Relocation section '.rela.discard.unwind_hints' at offset 0x3a8 contains 7 entries:
  Offset          Info           Type           Sym. Value    Sym. Name + Addend
000000000000  000a00000063 R_LARCH_32_PCREL  0000000000000000 .Lhere_1 + 0
00000000000c  000b00000063 R_LARCH_32_PCREL  00000000000000a8 .Lhere_50 + 0

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2024-03-11 22:23:47 +08:00
..
arch objtool/LoongArch: Enable orc to be built 2024-03-11 22:23:47 +08:00
Documentation objtool: Move noreturn function list to separate file 2023-05-16 06:31:55 -07:00
include/objtool objtool: Check local label in add_dead_ends() 2024-03-11 22:23:47 +08:00
.gitignore objtool: Install libsubcmd in build 2023-01-30 16:27:46 -08:00
Build objtool: Install libsubcmd in build 2023-01-30 16:27:46 -08:00
builtin-check.c objtool: Add verbose option for disassembling affected functions 2023-05-16 06:31:51 -07:00
check.c objtool: Check local label in read_unwind_hints() 2024-03-11 22:23:47 +08:00
elf.c objtool: Remove max symbol name length limitation 2023-10-05 17:01:28 -07:00
Makefile objtool/LoongArch: Enable orc to be built 2024-03-11 22:23:47 +08:00
noreturns.h cred: get rid of CONFIG_DEBUG_CREDENTIALS 2023-12-15 14:19:48 -08:00
objtool.c objtool: Propagate early errors 2023-10-05 17:01:11 -07:00
orc_dump.c objtool/x86: Separate arch-specific and generic parts 2024-03-11 22:23:47 +08:00
orc_gen.c objtool/x86: Separate arch-specific and generic parts 2024-03-11 22:23:47 +08:00
special.c objtool: Get rid of reloc->addend 2023-06-07 10:03:23 -07:00
sync-check.sh objtool: Add objtool_types.h 2023-03-23 23:18:56 +01:00
weak.c objtool: Ditch subcommands 2022-04-22 12:32:01 +02:00