Skip to content

Commit 120dd41

Browse files
xry111chenhuacai
authored andcommitted
LoongArch: Only allow OBJTOOL & ORC unwinder if toolchain supports -mthin-add-sub
GAS <= 2.41 does not support generating R_LARCH_{32,64}_PCREL for "label - ." and it generates R_LARCH_{ADD,SUB}{32,64} pairs instead. Objtool cannot handle R_LARCH_{ADD,SUB}{32,64} pair in __jump_table (static key implementation) and etc. so it will produce some warnings. This is causing the kernel CI systems to complain everywhere. For GAS we can check if -mthin-add-sub option is available to know if R_LARCH_{32,64}_PCREL are supported. For Clang, we require Clang >= 18 and Clang >= 17 already supports R_LARCH_{32,64}_PCREL. But unfortunately Clang has some other issues, so we disable objtool for Clang at present. Note that __jump_table here is not generated by the compiler, so -fno-jump-table is completely irrelevant for this issue. Fixes: cb8a2ef ("LoongArch: Add ORC stack unwinder support") Closes: https://lore.kernel.org/loongarch/Zl5m1ZlVmGKitAof@yujie-X299/ Closes: https://lore.kernel.org/loongarch/[email protected]/ Closes: https://lore.kernel.org/loongarch/[email protected]/ Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=816029e06768 Link: llvm/llvm-project@42cb3c6346fc Signed-off-by: Xi Ruoyao <[email protected]> Signed-off-by: Huacai Chen <[email protected]>
1 parent 6ba59ff commit 120dd41

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

arch/loongarch/Kconfig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ config LOONGARCH
143143
select HAVE_LIVEPATCH
144144
select HAVE_MOD_ARCH_SPECIFIC
145145
select HAVE_NMI
146-
select HAVE_OBJTOOL if AS_HAS_EXPLICIT_RELOCS
146+
select HAVE_OBJTOOL if AS_HAS_EXPLICIT_RELOCS && AS_HAS_THIN_ADD_SUB && !CC_IS_CLANG
147147
select HAVE_PCI
148148
select HAVE_PERF_EVENTS
149149
select HAVE_PERF_REGS
@@ -261,6 +261,9 @@ config AS_HAS_EXPLICIT_RELOCS
261261
config AS_HAS_FCSR_CLASS
262262
def_bool $(as-instr,movfcsr2gr \$t0$(comma)\$fcsr0)
263263

264+
config AS_HAS_THIN_ADD_SUB
265+
def_bool $(cc-option,-Wa$(comma)-mthin-add-sub)
266+
264267
config AS_HAS_LSX_EXTENSION
265268
def_bool $(as-instr,vld \$vr0$(comma)\$a0$(comma)0)
266269

arch/loongarch/Kconfig.debug

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ config UNWINDER_PROLOGUE
2828

2929
config UNWINDER_ORC
3030
bool "ORC unwinder"
31+
depends on HAVE_OBJTOOL
3132
select OBJTOOL
3233
help
3334
This option enables the ORC (Oops Rewind Capability) unwinder for

0 commit comments

Comments
 (0)