This is an archive of the discontinued LLVM Phabricator instance.

[lld] [test] Use LLD-specific binary&library dirs when building stand-alone
ClosedPublic

Authored by mgorny on Jan 31 2017, 10:10 AM.

Details

Summary

Use both LLD- and LLVM-specific binary&library directories when LLD is
being built stand-alone. This ensures that the freshly built tools and
libraries are found and used correctly.

Without this patch, the test suite uses LLVM_TOOLS_DIR and LLVM_LIBS_DIR
to locate lld, and set PATH and LD_LIBRARY_PATH. When doing
a stand-alone builds, these variables represent the installed LLVM.
As a result, tests either fail due to missing lld executables/libraries
or use an earlier installed LLD version rather than the one being built.

To solve this, an additional LLD_TOOLS_DIR and LLD_LIBS_DIR variables
are added that are populated using LLVM_*_OUTPUT_INTDIR. Those variables
are populated with directories used to output built executables
and libraries. In stand-alone builds, they represent the directories
used by LLD. In integrated builds, they have the same values as
LLVM_*_DIR and therefore using them does not harm.

The new variables are prepended to PATH and LD_LIBRARY_PATH to ensure
that freshly built binaries are preferred over potentially earlier
installed ones. Furthermore, the resulting PATH is used to locate tools
for substitutions since the search includes both tools built as part of
LLD and of LLVM.

Diff Detail

Repository
rL LLVM

Event Timeline

mgorny created this revision.Jan 31 2017, 10:10 AM
mgorny added a reviewer: beanz.Feb 3 2017, 9:14 AM

A gentle ping.

rnk accepted this revision.Feb 8 2017, 10:50 AM

lgtm

test/lit.cfg
183 ↗(On Diff #86450)

I guess there is a risk here that if llvm_tools_dir is missing an LLVM tool, we might accidentally pick up an old verison from PATH, but... I don't think that's a big deal.

This revision is now accepted and ready to land.Feb 8 2017, 10:50 AM
This revision was automatically updated to reflect the committed changes.