This is an archive of the discontinued LLVM Phabricator instance.

[AIX]: Fix option processing for -b
ClosedPublic

Authored by etiotto on Aug 9 2021, 3:07 PM.

Details

Summary

Code added by D106688 has a problem. It passes the option -bxyz to the system linker as -b xyz xyz (duplication of the string 'xyz' is incorrect). This patch fixes that oversight.

Diff Detail

Event Timeline

etiotto requested review of this revision.Aug 9 2021, 3:07 PM
etiotto created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptAug 9 2021, 3:07 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
etiotto edited the summary of this revision. (Show Details)Aug 9 2021, 3:07 PM
etiotto edited the summary of this revision. (Show Details)
jsji added a subscriber: jsji.Aug 9 2021, 3:19 PM

Tests please?

jsji added a reviewer: Restricted Project.Aug 9 2021, 3:21 PM
clang/lib/Driver/ToolChains/CommonArgs.cpp
261

Can we move the OPT_b block above into the if-else chain after the OPT_z case? The else occurring after the comment strikes me as being very unfortunate code formatting.

etiotto updated this revision to Diff 365311.Aug 9 2021, 4:18 PM

Adapting test for -b option processing on AIX

etiotto updated this revision to Diff 365312.Aug 9 2021, 4:25 PM

Address code review comment.

etiotto marked an inline comment as done.Aug 9 2021, 4:29 PM
This revision is now accepted and ready to land.Aug 9 2021, 4:34 PM
jsji accepted this revision as: jsji.Aug 9 2021, 4:36 PM

LGTM, Thanks.

clang/test/Driver/Xlinker-args.c
26

It would be better if we can tested mixing other options like -z .

etiotto added inline comments.Aug 9 2021, 4:45 PM
clang/test/Driver/Xlinker-args.c
26

I think the test is adequate as it guarantees options passed via "-b" are not going to be duplicated (which is the problem this PR addresses).

This revision was landed with ongoing or failed builds.Aug 9 2021, 5:07 PM
This revision was automatically updated to reflect the committed changes.
jsji added inline comments.Aug 9 2021, 5:17 PM
clang/test/Driver/Xlinker-args.c
26

Yes, it is testing what it tries to fix. However, it does NOT test what it *might* break. This is somehow similar to last patch, it does test what it wants -- passing down the option, but it did not test whether it pass more than needed.

The fix changes code related to handling of -z, so there is some risk of breaking -z, adding tests will ensure that the fix is good enough, and also prevent future regressions.

But yeah, as I said it is *better* to do that, not a must, depending on the quality level.