This is an archive of the discontinued LLVM Phabricator instance.

[Driver][X86] Reject unsupported value for -mabi=
ClosedPublic

Authored by MaskRay on May 25 2023, 3:30 PM.

Details

Summary

-mabi= was incorrectly claimed before D134671. -mabi=sysv appears to be
somewhat common in open-source packages, even if it was not intended to
be supported by Clang.
(For common options supported by multiple architectures, it's easy to
forget to report an error on unsupported targets. Unfortunately
the driver infrastructure doesn't make this less error-prone.)

On x86, support -mabi=sysv for non-Windows targets and -mabi=ms for Windows,
and remove the spurious -Wunused-command-line-argument warning.

With this change, all popular architectures claim -mabi=, so we don't
have to worry much about -Wunused-command-line-argument for other
architectures.

Diff Detail

Event Timeline

MaskRay created this revision.May 25 2023, 3:30 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2023, 3:30 PM
MaskRay requested review of this revision.May 25 2023, 3:30 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2023, 3:30 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
pengfei added inline comments.May 25 2023, 8:31 PM
clang/test/Driver/x86-mabi.c
7

What's the expected result for e.g. x86_64-pc-windows-gnu/mingw/cygnus ?

MaskRay added inline comments.May 25 2023, 9:58 PM
clang/test/Driver/x86-mabi.c
7

They use -mabi=ms, but I feel it's excessive to test all combinations.
(I think *windows-cygnus triples are likely dead.)

pengfei accepted this revision.May 25 2023, 10:34 PM

LGTM.

clang/test/Driver/x86-mabi.c
7

Agreed, just want to double confirm it. Thanks!

This revision is now accepted and ready to land.May 25 2023, 10:34 PM
This revision was landed with ongoing or failed builds.May 26 2023, 9:53 AM
This revision was automatically updated to reflect the committed changes.
clang/lib/Driver/ToolChains/Arch/X86.cpp