]> git.lizzy.rs Git - rust.git/commit
rustbuild: Tweak LLVM distribution layout
authorAlex Crichton <alex@alexcrichton.com>
Tue, 4 Sep 2018 19:57:27 +0000 (12:57 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Wed, 5 Sep 2018 16:17:20 +0000 (09:17 -0700)
commitbce09b6e34d97a4d71771c6283f25f6199e8e5c7
tree5f1f29caa392899704def94ef0a4d7ae0f409354
parent1c2e17f4e3a2070a7f703f51e29c1c388ef703b6
rustbuild: Tweak LLVM distribution layout

This commit tweaks the layout of a few components that we distribute to
hopefully fix across all platforms the recent issues with LLD being unable to
find the LLVM shared object. In #53245 we switched to building LLVM as a dynamic
library, which means that LLVM tools by default link to LLVM dynamically rather
than statically. This in turn means that the tools, at runtime, need to find the
LLVM shared library.

LLVM's shared library is currently distributed as part of the rustc component.
This library is located, however, at `$sysroot/lib`. The LLVM tools we ship are
in two locations:

* LLD is shipped at `$sysroot/lib/rustlib/$host/bin/rust-lld`
* Other LLVM tools are shipped at `$sysroot/bin`

Each LLVM tool has an embedded rpath directive indicating where it will search
for dynamic libraries. This currently points to `../lib` and is presumably
inserted by LLVM's build system. Unfortunately, though, this directive is only
correct for the LLVM tools at `$sysroot/bin`, not LLD!

This commit is targeted at fixing this situation by making two changes:

* LLVM tools other than LLD are moved in the distribution to
  `$sysroot/lib/rustlib/$host/bin`. This moves them next to LLD and should
  position them for...
* The LLVM shared object is moved to `$sysroot/lib/rustlib/$host/lib`

Together this means that all tools should natively be able to find the shared
object and the shared object should be installed all the time for the various
tools. Overall this should...

Closes #53813
src/bootstrap/dist.rs