This is an archive of the discontinued LLVM Phabricator instance.

[Driver] Mark m_x86_Features_Group options as TargetSpecific
ClosedPublic

Authored by MaskRay on Aug 2 2023, 8:11 PM.

Details

Summary

so that they lead to an error when compiled for non-x86 targets.
Follow-up to D151590.

% aarch64-linux-gnu-gcc -c -mavx a.c
aarch64-linux-gnu-gcc: error: unrecognized command-line option ‘-mavx’
% clang --target=aarch64-unknown-linux-gnu -c -mavx a.c  # without this patch
clang: warning: argument unused during compilation: '-mavx' [-Wunused-command-line-argument]
...

% clang --target=aarch64-unknown-linux-gnu -c -mavx a.c  # with this patch
clang: error: unsupported option '-mavx' for target 'aarch64-unknown-linux-gnu'

As a workaround for https://github.com/llvm/llvm-project/issues/63270, we don't
report an error for -msse4.2.

Diff Detail

Event Timeline

MaskRay created this revision.Aug 2 2023, 8:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2023, 8:11 PM
MaskRay requested review of this revision.Aug 2 2023, 8:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2023, 8:11 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
skan accepted this revision.Aug 2 2023, 8:24 PM

LGTM

This revision is now accepted and ready to land.Aug 2 2023, 8:24 PM
pengfei accepted this revision.Aug 2 2023, 8:46 PM
This revision was landed with ongoing or failed builds.Aug 3 2023, 7:05 PM
This revision was automatically updated to reflect the committed changes.