This is an archive of the discontinued LLVM Phabricator instance.

[Driver] Prevent Mips specific code from claiming -mabi argument on other targets.
ClosedPublic

Authored by craig.topper on Sep 26 2022, 1:25 PM.

Diff Detail

Event Timeline

craig.topper created this revision.Sep 26 2022, 1:25 PM
craig.topper requested review of this revision.Sep 26 2022, 1:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 26 2022, 1:25 PM
Herald added a subscriber: MaskRay. · View Herald Transcript
arichardson added inline comments.Sep 26 2022, 2:46 PM
clang/lib/Driver/Driver.cpp
636–637

Would it make more sense to move this into the if? It makes the diff bigger since everything inside has to be reindented, but only querying the flag if target is MIPS seems cleaner to me than the noclaim+a->claim approach.

660–661

Don't we have the same problem here?

MaskRay added inline comments.Sep 26 2022, 4:25 PM
clang/test/Driver/mabi.c
2

-target is legacy. Use --target=

craig.topper added inline comments.Sep 26 2022, 4:29 PM
clang/lib/Driver/Driver.cpp
636–637

I wasn't sure if I should expect someone might want to add another target. I'll change it.

Address review comments.
I didn't test the -march because all of the target I'm familiar with use -march.

This revision is now accepted and ready to land.Sep 27 2022, 12:16 AM
MaskRay accepted this revision.Sep 27 2022, 12:41 AM
erichkeane accepted this revision.Sep 27 2022, 5:52 AM

I don't think it's an issue for us to work around downstream, but this did regress support for -mabi=ms used in UEFI related build scripts.
https://github.com/ClangBuiltLinux/linux/issues/1725
Noting it in case others find their way here via bisection. Thanks to @nathanchance for the report.

I don't think it's an issue for us to work around downstream, but this did regress support for -mabi=ms used in UEFI related build scripts.
https://github.com/ClangBuiltLinux/linux/issues/1725
Noting it in case others find their way here via bisection. Thanks to @nathanchance for the report.

If that's intentional, should we call this out as a potentially breaking change in the release notes and post an announcement?

I don't think it's an issue for us to work around downstream, but this did regress support for -mabi=ms used in UEFI related build scripts.
https://github.com/ClangBuiltLinux/linux/issues/1725
Noting it in case others find their way here via bisection. Thanks to @nathanchance for the report.

If that's intentional, should we call this out as a potentially breaking change in the release notes and post an announcement?

I feel that this is still a minor issue. If we consider this as potentially breaking change, then we'd add many many driver changes as potentially breaking.
I think we should wait for more evidence.

I don't think it's an issue for us to work around downstream, but this did regress support for -mabi=ms used in UEFI related build scripts.
https://github.com/ClangBuiltLinux/linux/issues/1725
Noting it in case others find their way here via bisection. Thanks to @nathanchance for the report.

If that's intentional, should we call this out as a potentially breaking change in the release notes and post an announcement?

I feel that this is still a minor issue. If we consider this as potentially breaking change, then we'd add many many driver changes as potentially breaking.
I think we should wait for more evidence.

Perfect, thank you for verifying! (That's my intuition as well, but I was on the fence and wondering if my intuition was wrong.)

craig.topper added a comment.EditedSep 30 2022, 1:29 PM

I don't think it's an issue for us to work around downstream, but this did regress support for -mabi=ms used in UEFI related build scripts.
https://github.com/ClangBuiltLinux/linux/issues/1725
Noting it in case others find their way here via bisection. Thanks to @nathanchance for the report.

Is there an expectation that we honor -mabi=ms and something that matches gcc? The original bug report I was fixing was that we silently ignored it.

I appears clang 7 did warn for this. clang 8 stopped warning, maybe that's when the Mips code was added. If it was, I don't think it was intentional.

I don't think it's an issue for us to work around downstream, but this did regress support for -mabi=ms used in UEFI related build scripts.
https://github.com/ClangBuiltLinux/linux/issues/1725
Noting it in case others find their way here via bisection. Thanks to @nathanchance for the report.

Is there an expectation that we honor -mabi=ms and something that matches gcc? The original bug report I was fixing was that we silently ignored it.

No, I don't think so. The kernel was checking -mabi=ms to check for the existence of __attribute__((ms_abi)), which is not as accurate of a check as it could have been, since the kernel has the ability to run small programs during configuration time, which could have just checked for __attribute__((ms_abi)) directly. The kernel does not use -mabi=ms as part of its compiler flags anywhere, it only uses the attribute, so I don't think there is any value to trying to support -mabi=ms unless there is another use case for it. We are just going to clean up the -mabi=ms check and backport it: https://lore.kernel.org/20220929152010.835906-1-nathan@kernel.org/

I appears clang 7 did warn for this. clang 8 stopped warning, maybe that's when the Mips code was added. If it was, I don't think it was intentional.

Right, I would agree with that assessment.