Page MenuHomePhabricator

[AIX] Pass the -b option to linker on AIX
ClosedPublic

Authored by anjankgk on Jul 23 2021, 10:30 AM.

Details

Summary

We want to parse the -b option in the driver and pass it to the linker if the target OS is AIX. This will establish compatibility with the other AIX compilers.

Diff Detail

Event Timeline

anjankgk created this revision.Jul 23 2021, 10:30 AM
anjankgk requested review of this revision.Jul 23 2021, 10:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 23 2021, 10:30 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Gentle ping..

ZarkoCA added inline comments.Jul 27 2021, 2:17 PM
clang/lib/Driver/ToolChains/CommonArgs.cpp
262–269

Can this be reversed so the error check is first for (!T.isOSAIX()) instead? Then you don't need the else.

clang/test/Driver/Xlinker-args.c
15–16

Does this mean that we need space between -b and the linker option when using clang normally? Or this an artifact of the way we need to write tests?

anjankgk updated this revision to Diff 362412.Jul 28 2021, 8:49 AM

Addressed review comments

anjankgk marked an inline comment as done.Jul 28 2021, 8:50 AM
anjankgk added inline comments.
clang/test/Driver/Xlinker-args.c
15–16

Yes, since the option is defined as "JoinedOrSeparate" in the td file it wouldn't actually need the space.

ZarkoCA accepted this revision.Jul 28 2021, 12:33 PM

LGTM with small nit, thanks.

clang/lib/Driver/ToolChains/CommonArgs.cpp
263

nit, I prefer this error message but it's up to you.

This revision is now accepted and ready to land.Jul 28 2021, 12:33 PM

Thank you reviewing Zarko!

clang/lib/Driver/ToolChains/CommonArgs.cpp
263

I intentionally chose that error msg (without target mention) since that's the one the original option threw (existing '-b' option which was defined as unsupported for all the platforms).

ZarkoCA added inline comments.Jul 28 2021, 12:50 PM
clang/lib/Driver/ToolChains/CommonArgs.cpp
263

I see, that makes sense.

But now with your patch this option is supported even if only for the AIX target. So we could make the case to use the suggested error message. That said, I am still fine with what you choose.

anjankgk marked an inline comment as done.Jul 28 2021, 9:07 PM
anjankgk added inline comments.
clang/lib/Driver/ToolChains/CommonArgs.cpp
263

I actually agree on your point. So, eventhough my intention was to leave the behavior on other (non-AIX) platforms unaffected, the change causes the behavior of the option to be more target-specific - since it's now valid/supported option on AIX. So, I am going to change this error message as suggested. Thanks!

anjankgk updated this revision to Diff 362622.Jul 28 2021, 9:08 PM
anjankgk marked an inline comment as done.

Change the error msg to include target information.

This revision was landed with ongoing or failed builds.Jul 29 2021, 11:15 AM
This revision was automatically updated to reflect the committed changes.