This is an archive of the discontinued LLVM Phabricator instance.

[clang][driver][AIX] accept maix32/maix64 gcc compat options
ClosedPublic

Authored by daltenty on Mar 8 2023, 1:42 PM.

Details

Summary

GCC on AIX primarily uses the -maix32 and -maix64 to select the bitmode to target. In order to be compatible with existing build configurations, clang should accept these options as well. In this patch we implement these options for AIX targets.

Diff Detail

Event Timeline

daltenty created this revision.Mar 8 2023, 1:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 8 2023, 1:42 PM
daltenty requested review of this revision.Mar 8 2023, 1:42 PM
francii added a comment.EditedMar 8 2023, 2:40 PM

Should we not still throw a warning/error if someone uses these flags on other platforms?

If I use these flags on GCC on Linux, for example, I get an unknown argument error. I understand we don't do extensive checking for bitmode combinations, so is target checking something to add in the future?

daltenty updated this revision to Diff 503977.Mar 9 2023, 4:40 PM
daltenty retitled this revision from [clang][driver] accept maix32/maix64 gcc compat options to [clang][driver][AIX] accept maix32/maix64 gcc compat options.
daltenty edited the summary of this revision. (Show Details)

Produce a diagnostic if the options are used with non-AIX targets

francii accepted this revision.Mar 10 2023, 9:13 AM

LGTM!

This revision is now accepted and ready to land.Mar 10 2023, 9:13 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 13 2023, 2:06 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
MaskRay added inline comments.May 30 2023, 12:12 PM
clang/lib/Driver/Driver.cpp
598 ↗(On Diff #504840)

It'd be nice to leverage the TargetSpecific mechanism introduced in D151590 to simplify code here.

602 ↗(On Diff #504840)

Does AIX use -m32/-m64? If not, reject the two options on AIX.

It may be cleaner to do

if (AIX) {
  ... // introduce a new block of code here
} else {
  existing `Target.setEnvironment` code
}

-mx32 is x86-specific