linux-loongson/tools/objtool
Tiezhu Yang a47bc954cf objtool/LoongArch: Get table size correctly if LTO is enabled
When compiling with LLVM and CONFIG_LTO_CLANG is set, there exist many
objtool warnings "sibling call from callable instruction with modified
stack frame".

For this special case, the related object file shows that there is no
generated relocation section '.rela.discard.tablejump_annotate' for the
table jump instruction jirl, thus objtool can not know that what is the
actual destination address.

It needs to do something on the LLVM side to make sure that there is the
relocation section '.rela.discard.tablejump_annotate' if LTO is enabled,
but in order to maintain compatibility for the current LLVM compiler,
this can be done in the kernel Makefile for now. Ensure it is aware of
linker with LTO, '--loongarch-annotate-tablejump' needs to be passed via
'-mllvm' to ld.lld.

Before doing the above changes, it should handle the special case of the
relocation section '.rela.discard.tablejump_annotate' to get the correct
table size first, otherwise there are many objtool warnings and errors
if LTO is enabled.

There are many different rodata for each function if LTO is enabled, it
is necessary to enhance get_rodata_table_size_by_table_annotate().

Fixes: b95f852d3a ("objtool/LoongArch: Add support for switch table")
Closes: https://lore.kernel.org/loongarch/20250731175655.GA1455142@ax162/
Reported-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2025-08-20 22:23:15 +08:00
..
arch objtool/LoongArch: Get table size correctly if LTO is enabled 2025-08-20 22:23:15 +08:00
Documentation objtool: Fix up some outdated references to ENTRY/ENDPROC 2025-03-25 09:20:27 +01:00
include/objtool objtool: Speed up SHT_GROUP reindexing 2025-05-14 13:09:02 +02: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: Change "warning:" to "error: " for fatal errors 2025-04-01 09:07:13 +02:00
check.c hardening updates for v6.17-rc1 2025-07-28 17:16:12 -07:00
elf.c objtool: Speed up SHT_GROUP reindexing 2025-05-14 13:09:02 +02:00
Makefile objtool: Hide unnecessary compiler error message 2025-03-12 15:43:38 -07:00
noreturns.h objtool: Add vpanic() to the noreturn list 2025-07-11 14:25:21 -04:00
objtool.c objtool: Change "warning:" to "error: " for fatal errors 2025-04-01 09:07:13 +02:00
orc_dump.c objtool: Change "warning:" to "error: " for fatal errors 2025-04-01 09:07:13 +02:00
orc_gen.c objtool/x86: Separate arch-specific and generic parts 2024-03-11 22:23:47 +08:00
special.c objtool: Change "warning:" to "error: " for fatal errors 2025-04-01 09:07:13 +02: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