[clang] [llvm] [AArch64] Add support for -mlong-calls code generation (PR #142982)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 5 09:33:12 PDT 2025


MaskRay wrote:

-mlong-calls is an old-fashioned compiler option. I think it was added before linkers knew range extension thunks (aka stubs, veneers, etc).

Can you use -fno-plt instead? It works with both SelectionDAG and GlobalISel. You will get GOT-generating code sequence that can be optimized to adrp+add by the linker.
You can use --emit-relocs to get relocations in the executable.
We could implement `__attribute__((noplt))`, if you want the patching to be per-function.

The proposed -mlong-calls is -fno-pic hack that works with limited scenarios with a large performance downside. I don't think we should support it.


https://github.com/llvm/llvm-project/pull/142982


More information about the llvm-commits mailing list