diff options
| author | Jethro Beekman <jethro@fortanix.com> | 2021-08-30 11:37:02 +0200 |
|---|---|---|
| committer | Jethro Beekman <jethro@fortanix.com> | 2021-08-30 12:45:56 +0200 |
| commit | 446c42945d7518e848ba9b9f7c844d6b3cc7b892 (patch) | |
| tree | 3313b3c246fee3450db0749d6b81d177195b19f2 /src/bootstrap | |
| parent | 9556d7a09a7e80e84430071b29d118f39dde8205 (diff) | |
| download | rust-446c42945d7518e848ba9b9f7c844d6b3cc7b892.tar.gz rust-446c42945d7518e848ba9b9f7c844d6b3cc7b892.zip | |
Fix LLVM libunwind build for non-musl targets
Broken in #85600
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/compile.rs | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 8f27adaed84..df9e9bce415 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -142,6 +142,14 @@ fn copy_and_stamp( target_deps.push((target, dependency_type)); } +fn copy_llvm_libunwind(builder: &Builder<'_>, target: TargetSelection, libdir: &Path) -> PathBuf { + let libunwind_path = builder.ensure(native::Libunwind { target }); + let libunwind_source = libunwind_path.join("libunwind.a"); + let libunwind_target = libdir.join("libunwind.a"); + builder.copy(&libunwind_source, &libunwind_target); + libunwind_target +} + /// Copies third party objects needed by various targets. fn copy_third_party_objects( builder: &Builder<'_>, @@ -167,6 +175,15 @@ fn copy_third_party_objects( ); } + if target == "x86_64-fortanix-unknown-sgx" + || builder.config.llvm_libunwind == LlvmLibunwind::InTree + && (target.contains("linux") || target.contains("fuchsia")) + { + let libunwind_path = + copy_llvm_libunwind(builder, target, &builder.sysroot_libdir(*compiler, target)); + target_deps.push((libunwind_path, DependencyType::Target)); + } + target_deps } @@ -208,6 +225,9 @@ fn copy_self_contained_objects( builder.copy(&src, &target); target_deps.push((target, DependencyType::TargetSelfContained)); } + + let libunwind_path = copy_llvm_libunwind(builder, target, &libdir_self_contained); + target_deps.push((libunwind_path, DependencyType::TargetSelfContained)); } else if target.ends_with("-wasi") { let srcdir = builder .wasi_root(target) @@ -234,18 +254,6 @@ fn copy_self_contained_objects( } } - if target.contains("musl") - || target.contains("x86_64-fortanix-unknown-sgx") - || builder.config.llvm_libunwind == LlvmLibunwind::InTree - && (target.contains("linux") || target.contains("fuchsia")) - { - let libunwind_path = builder.ensure(native::Libunwind { target }); - let libunwind_source = libunwind_path.join("libunwind.a"); - let libunwind_target = libdir_self_contained.join("libunwind.a"); - builder.copy(&libunwind_source, &libunwind_target); - target_deps.push((libunwind_target, DependencyType::TargetSelfContained)); - } - target_deps } |
