On Tue, 2026-07-07 at 15:20 +0800, George Guo wrote:
> From: George Guo <[email protected]>
>
> On LoongArch, the "key - ." field of a __jump_table entry can come out
> as two relocations at the same offset, R_LARCH_ADD64 plus
> R_LARCH_SUB64. clang's integrated assembler emits this pair when the
> key symbol is not defined in the same translation unit (for example
> __tracepoint_netif_rx); GAS, and clang for locally-defined keys,
> produce a single R_LARCH_64_PCREL instead, which is why GCC builds do
> not hit this.
Hmm, is this a flaw in LLVM? We have
config AS_HAS_THIN_ADD_SUB
def_bool $(cc-option,-Wa$(comma)-mthin-add-sub) || AS_IS_LLVM
so we are already expecting LLVM to emit R_LARCH_64_PCREL always instead
of ADD64/SUB64.
--
Xi Ruoyao <[email protected]>