This is an archive of the discontinued LLVM Phabricator instance.

[lit][tests]Add libc++ to link XRay test cases if libc++ is used to build CLANG
ClosedPublic

Authored by xingxue on Apr 23 2019, 6:54 AM.

Details

Summary

When libc++ is used to build CLANG, its XRay libraries libclang_rt.xray-*.a have dependencies on libc++. Therefore, libc++ is needed to link and run XRay test cases. For Linux -rpath is also needed to specify where to load libc++. This change sets macro LLVM_LIBCXX_USED to 1 if libc++ is actually used in the build. XRay tests then check the flag and add -L<llvm_shlib_dir> -lc++ and -Wl,-rpath=<llvm_shlib_dir> if needed.

Diff Detail

Repository
rL LLVM

Event Timeline

xingxue created this revision.Apr 23 2019, 6:54 AM

The test updates make sense given the current Clang driver behaviour; however, I think there is a question as to whether the Clang driver should be updated to add -lc++, etc. as necessary when it "automatically" links in compiler-rt libraries with such dependencies.

The test updates make sense given the current Clang driver behaviour; however, I think there is a question as to whether the Clang driver should be updated to add -lc++, etc. as necessary when it "automatically" links in compiler-rt libraries with such dependencies.

Thanks @xingxue for the off-list discussion. I agree that the Clang driver behaviour is a larger design question over packaging that should be a separate discussion at a later time. I'm good with this change to the tests, but I'd like to see if the other reviewers have comments to add.

dberris accepted this revision.Apr 25 2019, 7:17 PM

LGTM -- thanks for looking into this!

This revision is now accepted and ready to land.Apr 25 2019, 7:17 PM

@xingxue, I believe that you have had a good number of patches committed into the project already (rCXX195144, rL356104, rCRT356844). Please go ahead with requesting commit access, and commit this patch when you are ready.

@hubert.reinterpretcast, @dberris, thanks for the review! I will commit once I get the permission.

amyk accepted this revision.Apr 30 2019, 12:32 PM

I think this LGTM.

This revision was automatically updated to reflect the committed changes.