This is an archive of the discontinued LLVM Phabricator instance.

[Driver] Also warn about -mwatchos-version-min and -mtvos-version-min
ClosedPublic

Authored by porglezomp on Jul 16 2023, 2:00 PM.

Details

Summary

Sometimes users pass this option when targeting embedded architectures like armv7m on non-darwin platforms.
This applies to watchOS and tvOS as well as iOS.

Depends on D155407

Diff Detail

Event Timeline

porglezomp created this revision.Jul 16 2023, 2:00 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 16 2023, 2:00 PM
porglezomp requested review of this revision.Jul 16 2023, 2:00 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 16 2023, 2:00 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
ahatanak added inline comments.Jul 17 2023, 9:29 AM
clang/lib/Driver/ToolChains/Darwin.cpp
89

I just realized this isn't correct as it accepts -mios-version-min= when the OS is tvOS, e.g., clang -arch armv7m --target=thumbv7-apple-tvos -mios-version-min=5 ....

https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/TargetParser/Triple.h#L497

Can you fix this by calling Triple::getOS() to check the OS?

Update to check the target OSes more precisely

porglezomp marked an inline comment as done.Jul 17 2023, 11:35 AM
MaskRay accepted this revision.Jul 17 2023, 11:36 AM
This revision is now accepted and ready to land.Jul 17 2023, 11:36 AM
This revision was landed with ongoing or failed builds.Jul 17 2023, 1:27 PM
This revision was automatically updated to reflect the committed changes.