This is an archive of the discontinued LLVM Phabricator instance.

[HIP] Fix unbundling archive
ClosedPublic

Authored by yaxunl on Oct 11 2022, 4:01 PM.

Details

Summary

When -lxxx is specified, if there happens to have a directory or
file with name xxx, clang will not look up libxxx.a, but will
try to unbundle xxx instead.

Diff Detail

Event Timeline

yaxunl created this revision.Oct 11 2022, 4:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 11 2022, 4:01 PM
yaxunl requested review of this revision.Oct 11 2022, 4:01 PM
saiislam accepted this revision.Oct 12 2022, 4:21 AM

Thank you!
It is fixing our OpenMP smoke test failure.

This revision is now accepted and ready to land.Oct 12 2022, 4:21 AM
tra added inline comments.Oct 12 2022, 10:32 AM
clang/lib/Driver/ToolChains/CommonArgs.cpp
1866–1870

I'm puzzled a bit. What is expected to be in 'Lib' ?
If it contains the the whole -llibrary option passed by the user, then why do we check for : prefix?
If it contains whatever was passed via -l<something>, but without -l itself, then why do we check for -l prefix?

yaxunl added inline comments.Oct 12 2022, 10:43 AM
clang/lib/Driver/ToolChains/CommonArgs.cpp
1866–1870

This function is also used for unbundling archive files specified as input files in the clang command line. There are three cases:

For option -l:xxx, Lib contains :xxx.

For option -lxxx, Lib contains -lxxx.

For xxx.a passed as input file, Lib contains xxx.a.

tra accepted this revision.Oct 12 2022, 11:02 AM

LGTM

clang/lib/Driver/ToolChains/CommonArgs.cpp
1866–1870

Interesting. It may be worth adding a comment, because this convention is not at all obvious.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptOct 12 2022, 1:39 PM