-
Notifications
You must be signed in to change notification settings - Fork 14.7k
ARM: Remove check for isAAPCS_ABI when enabling various aeabi calls #152108
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
base: main
Are you sure you want to change the base?
ARM: Remove check for isAAPCS_ABI when enabling various aeabi calls #152108
Conversation
Based on computeDefaultTargetABI, this appears to be redundant. The only test using the explicit -target-abi flag with a value different than one implied by the triple (i.e. assert(TM.isAAPCS_ABI()) under the condition) is arm-abi-attr.ll and it doesn't stress the libcalls used.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
@llvm/pr-subscribers-backend-arm Author: Matt Arsenault (arsenm) ChangesBased on computeDefaultTargetABI, this appears to be redundant. The only test using the explicit -target-abi flag with a value different Full diff: https://github.com/llvm/llvm-project/pull/152108.diff 1 Files Affected:
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index 7f8b4460bb814..a621e5c63eb07 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -588,8 +588,8 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM_,
}
// RTLIB
- if (TM.isAAPCS_ABI() && (TT.isTargetAEABI() || TT.isTargetGNUAEABI() ||
- TT.isTargetMuslAEABI() || TT.isAndroid())) {
+ if (TT.isTargetAEABI() || TT.isTargetGNUAEABI() || TT.isTargetMuslAEABI() ||
+ TT.isAndroid()) {
// FIXME: This does not depend on the subtarget and should go directly into
// RuntimeLibcalls. This is only here because of missing support for setting
// the calling convention of an implementation.
|
This was set if `TT.isTargetAEABI()`. This was previously set above if `TM.isAAPCS_ABI() && (TT.isTargetAEABI() || TT.isTargetGNUAEABI() || TT.isTargetMuslAEABI() || TT.isAndroid())`. So this could differ based on a manually specified -target-abi flag due to the `isAAPCS_ABI` part of the original condition. I'm guessing these should be consistent, so either this second group of setLibcallImpl calls should have been guarded by the `isAAPCS_ABI` check, or the first condition should remove it. There doesn't appear to be any meaningful test coverage using the manually specified ABI option, so #152108 tries to remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm,wait, doesn't the GNU side set up the GNU calls?
I don't really see any path in here I would call the "GNU side", but this condition doesn't touch any __gnu calls. The only references to those are below under |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can directly specify the ABI using the clang "-mabi" flag on 32-bit ARM. Given that functionality exists, probably someone is using it somehow.
If we want to rip out support for using -mabi to switch the ABI on 32-bit Arm targets, I wouldn't be opposed; it's not really useful to generate code with the wrong ABI. But if we do, we should rip it out all at once, with an explicit hard error in clang, not subtly break it over time.
This was set if `TT.isTargetAEABI()`. This was previously set above if `TM.isAAPCS_ABI() && (TT.isTargetAEABI() || TT.isTargetGNUAEABI() || TT.isTargetMuslAEABI() || TT.isAndroid())`. So this could differ based on a manually specified -target-abi flag due to the `isAAPCS_ABI` part of the original condition. I'm guessing these should be consistent, so either this second group of setLibcallImpl calls should have been guarded by the `isAAPCS_ABI` check, or the first condition should remove it. There doesn't appear to be any meaningful test coverage using the manually specified ABI option, so #152108 tries to remove it
The folks I remember were using and working in this area were @compnerd @jroelofs @kraj
There is a confusion between In most cases, the only difference is the function name, so both compilers had the additional symbols in some fashion. Some calls like Technically, asking for Now that the linking errors stopped (AFAIK, of course), I'm assuming whatever is the state, is "stable", but not correct. It may never be correct. Removing |
I've only seen the The -mabi option looks to mirror a GCC option https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html#index-mabi-1 which I believe was used during the transition from the pre-ABI to post ABI (2004). Assuming that that ATPCS, APCS and AAPCS are referring to the ABI names [1]. The APCS and ATPCS are pre ABI (2004 ish). I think ARM Linux stayed on the pre-ABI PCS for some time after that, but I don't think that would be supported anymore in GCC. As to what these options do in clang/LLVM we'd need to reverse engineer them. I expect that keeping -mabi might aid in command-line compatibility with GCC but I wouldn't expect it to be used in embedded systems. From the ABI https://github.com/ARM-software/abi-aa/blob/main/aapcs32/aapcs32.rst#23terms-and-abbreviations
|
haven't reviewed the rest of the PR yet, but I'm pretty sure we have firmware projects relying on this spelling of it. |
We can "remove" support for -mabi without actually removing the flag; just only allow -mabi specifications that don't actually change the ABI. |
I waa trying to add musl support and |
There are quite a few references in https://github.com/search?q=mabi%3Daapcs&type=code, I'm not sure if they do much that is useful. |
I don't have any particular interest in keeping or removing -mabi; my issue is this is just untested complexity in the backend. If there was test coverage there wouldn't be an issue |
Based on computeDefaultTargetABI, this appears to be redundant.
The only test using the explicit -target-abi flag with a value different
than one implied by the triple (i.e. assert(TM.isAAPCS_ABI()) under
the condition) is arm-abi-attr.ll and it doesn't stress the libcalls
used.