This is an archive of the discontinued LLVM Phabricator instance.

[AIX][Clang][Driver] Generate reference to the C++ library on the link step
ClosedPublic

Authored by ShuhongL on Aug 5 2020, 7:53 AM.

Details

Summary

Have the linker find libc++ on its search path by adding -lc++.

Diff Detail

Event Timeline

ShuhongL created this revision.Aug 5 2020, 7:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 5 2020, 7:53 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
ShuhongL requested review of this revision.Aug 5 2020, 7:53 AM

Working on adding lit test

clang/lib/Driver/ToolChains/AIX.cpp
155

This is commonly added before -lc, etc. To be consistent with other targets, please switch the order of this block with the previous one.

210

Should this be a report_fatal_error? Note that the error message should not have a period at the end in that case.

hubert.reinterpretcast retitled this revision from [AIX][Clang] Add C++ linker option to the driver toolchain to [AIX][Clang][Driver] Generate reference to the C++ library on the link step.Aug 5 2020, 4:42 PM
hubert.reinterpretcast edited the summary of this revision. (Show Details)
ShuhongL updated this revision to Diff 283607.Aug 6 2020, 7:34 AM

Added testcases for lc and lc++

ShuhongL marked 2 inline comments as done.Aug 6 2020, 7:34 AM
clang/lib/Driver/ToolChains/AIX.cpp
210

Should there be a test for the error message?

211

I suggest using return inside the switch and having llvm_unreachable after the switch if the switch is expected to handle all of the possible cases.

clang/test/Driver/aix-ld.c
18

Should there be tests that the C++ library is not included when linking with a C invocation?

ShuhongL updated this revision to Diff 283988.Aug 7 2020, 12:28 PM

Added test cases for fatal error

ShuhongL marked 3 inline comments as done.Aug 7 2020, 12:29 PM

LGTM with minor edits.

clang/lib/Driver/ToolChains/AIX.cpp
213

Minor nit: Follow normal capitalization rules when not formatting for a user-facing error message that falls under https://llvm.org/docs/CodingStandards.html#id15.

clang/test/Driver/aix-ld.c
326–328

Minor nit: We align the options to a utility on later lines with the options to the utility on earlier lines.

333–335
This revision is now accepted and ready to land.Aug 7 2020, 12:47 PM
ShuhongL updated this revision to Diff 284357.Aug 10 2020, 7:19 AM

Fixed indent and updated error message.

ShuhongL marked 3 inline comments as done.Aug 10 2020, 7:20 AM
ShuhongL closed this revision.Aug 10 2020, 8:11 AM

Landed by commit: rGb129c9d81aff8ece71eb29df1e5f31136a48c040
(Sorry, I didn't properly align the tags in commit message and hence this revision was not automatically closed after landing to master. Will switch to Arc)