Re: [PATCH v3 12/12] objtool/klp: Fold LoongArch paired ADD/SUB relocations into PCREL

Xi Ruoyao <[email protected]>
Newsgroups dev.linux.lists.llvm,dev.linux.lists.loongarch,org.kernel.vger.linux-kernel,org.kernel.vger.live-patching
Message-ID <[email protected]>
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]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.