This is an archive of the discontinued LLVM Phabricator instance.

clang driver throws error for -mabi=elfv2 or elfv2
ClosedPublic

Authored by long5hot on Jul 26 2023, 10:51 AM.

Details

Summary

After clang release/16.x there is a regression that -mabi=elfv1
or -mabi=elfv2 are being unused and throws warning. But clang-trunk
throws error for -mabi=elfv2 or elfv1. Intent of this patch to accept
elfv1 or elfv2 for -mabi.

PR : https://github.com/llvm/llvm-project/issues/64122
godBolt : https://godbolt.org/z/asbMY1K37

Diff Detail

Event Timeline

long5hot created this revision.Jul 26 2023, 10:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 26 2023, 10:51 AM
long5hot requested review of this revision.Jul 26 2023, 10:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 26 2023, 10:51 AM
long5hot added reviewers: jhibbits, nemanjai, sfertile, Restricted Project.Jul 26 2023, 10:53 AM
long5hot edited the summary of this revision. (Show Details)

After clang release/16.x there is a regression that -mabi=elfv1 or -mabi=elfv2 are being unused and throws warning.

Please just give the full clang command line and add a test case under test/Driver. FWIW: clang --target=powerpc64le-linux-gnu -mabi=elfv1 -mabi=elfv2 -c a.c works for me without any warning.

long5hot updated this revision to Diff 544674.Jul 27 2023, 3:06 AM

failure is only when we do not give full target triple.
for e.x. --target=ppc64 -mabi=elfv2
or even when OS option is unknown e.g. --target=powerpc64-unknown-gnu

nemanjai accepted this revision.Jul 27 2023, 11:08 AM

Ah, ok. This makes sense. When we don't know anything about the ABI, it makes sense to rely on -mabi.

This revision is now accepted and ready to land.Jul 27 2023, 11:08 AM
MaskRay added inline comments.Jul 27 2023, 10:50 PM
clang/test/Driver/ppc-abi.c
18

-target has been deprecated since Clang 3.4. Use --target= for new tests:_

This revision was landed with ongoing or failed builds.Jul 29 2023, 3:44 AM
This revision was automatically updated to reflect the committed changes.
long5hot added inline comments.Jul 29 2023, 3:49 AM
clang/test/Driver/ppc-abi.c
18

Did a small testCase change here, because of this #64194 bug ..