Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions library/unwind/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ fn main() {
}

mod llvm_libunwind {
use std::env;
use std::path::Path;
use std::path::{Path, PathBuf};
use std::{env, fs, io};

/// Compile the libunwind C/C++ source code.
pub fn compile() {
Expand All @@ -76,6 +76,14 @@ mod llvm_libunwind {
let mut cpp_cfg = cc::Build::new();
let root = Path::new("../../src/llvm-project/libunwind");

// We depend on starting with a fresh build directory each time.
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
if let Err(x) = fs::remove_dir_all(&out_dir) {
if x.kind() != io::ErrorKind::NotFound {
panic!("Failed removing OUT_DIR at {}: {}", out_dir.display(), x);
}
}

cpp_cfg.cpp(true);
cpp_cfg.cpp_set_stdlib(None);
cpp_cfg.flag("-nostdinc++");
Expand Down Expand Up @@ -137,7 +145,7 @@ mod llvm_libunwind {
"UnwindRegistersSave.S",
];

let cpp_sources = vec!["Unwind-EHABI.cpp", "Unwind-seh.cpp", "libunwind.cpp"];
let cpp_sources = &["Unwind-EHABI.cpp", "Unwind-seh.cpp", "libunwind.cpp"];
let cpp_len = cpp_sources.len();

if target.contains("x86_64-fortanix-unknown-sgx") {
Expand Down