-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Support fno-plt like gcc #78275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Sorry, it's been a while. Trying to understand what you want to achieve here, Is it that you have a PLT call in inline asm that you want to avoid with -fno-plt? |
I want to achieve you proposed in gcc https://gcc.gnu.org/legacy-ml/gcc-patches/2015-05/msg00001.html @tmsri https://godbolt.org/z/Yeor6TTeE For now, the |
mips has I have some notes on https://maskray.me/blog/2021-09-19-all-about-procedure-linkage-table#fno-plt . |
gcc support -mplt only for TARGET_ABSOLUTE_ABICALLS. #define TARGET_ABSOLUTE_ABICALLS For normal PIC ELFs, all of them are no-plt. I think that it makes no sense to support it on LLVM. |
mips's situation is different. For most other architectures (probably all supported by LLVM), |
Clang sets the nonlazybind attribute for certain ObjC features. The AArch64 SelectionDAG implementation for non-intrinsic calls (46e36f0) is behind a cl option. GCC implements -fno-plt for a few ELF targets. In Clang, -fno-plt also sets the nonlazybind attribute. For SelectionDAG, make the cl option not affect ELF so that non-intrinsic calls to a dso_preemptable function use GOT. Adjust AArch64TargetLowering::LowerCall to handle intrinsic calls. For FastISel, change `fastLowerCall` to bail out when a call is due to -fno-plt. For GlobalISel, handle non-intrinsic calls in CallLowering::lowerCall and intrinsic calls in AArch64CallLowering::lowerCall (where the target-independent CallLowering::lowerCall is not called). The GlobalISel test in `call-rv-marker.ll` is therefore updated. Note: the current -fno-plt -fpic implementation does not use GOT for a preemptable function. Link: #78275 Pull Request: #78890
It doesn't seem to be implemented for 32bit x86 and x86 GlobalISel. https://godbolt.org/z/aa6jqraPY void bar(void);
void foo(void)
{
bar();
} ; clang -m32 -O3 -fpic -fno-plt
foo(): # @foo()
push ebx
sub esp, 8
call .L0$pb
.L0$pb:
pop ebx
.Ltmp0:
add ebx, offset _GLOBAL_OFFSET_TABLE_+(.Ltmp0-.L0$pb)
call bar()@PLT
add esp, 8
pop ebx
ret
; gcc -m32 -O3 -fpic -fno-plt
foo():
call __x86.get_pc_thunk.ax
add eax, OFFSET FLAT:_GLOBAL_OFFSET_TABLE_
jmp [DWORD PTR _Z3barv@GOT[eax]]
__x86.get_pc_thunk.ax:
mov eax, DWORD PTR [esp]
ret
|
@llvm/issue-subscribers-backend-aarch64 Author: None (hstk30-hw)
Hi, I see https://reviews.llvm.org/D39079 add the support for `fno-plt` in frontend. But has no affect on asm code.
https://discourse.llvm.org/t/bug-fno-plt-has-no-effect/57986 If I want to support |
I test it in AArch64, gets 1.x% improvement, and branch-miss is down. Thx @MaskRay |
Hi, I see https://reviews.llvm.org/D39079 add the support for
fno-plt
in frontend. But has no affect on asm code.https://discourse.llvm.org/t/bug-fno-plt-has-no-effect/57986
If I want to support
fno-plt
in clang like gcc, Where should I start?The text was updated successfully, but these errors were encountered: