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

dong jianqiang via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 8 18:23:07 PDT 2025


dongjianqiang2 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.

Yes, we are indeed still using the -mlong-calls option in our older embedded systems. This is necessary due to the lack of support for GOT-based relocation types in these environments. As a result, we have incorporated this option to ensure compatibility and functionality.

Moving forward, it's important of adding support in SelectionDAG and GlobalISel for these scenarios. 

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


More information about the llvm-commits mailing list