Skip to content

Commit

Permalink
Auto merge of rust-lang#122003 - mati865:gnullvm-build-libunwind, r=<…
Browse files Browse the repository at this point in the history
…try>

Build libunwind for pc-windows-gnullvm

Alternative to rust-lang#121794

The changes in this PR:
- build libunwind for `pc-windows-gnullvm` targets
- join paths with `join()` instead of slashes to avoid mixing slashes on windows, this changes it them from `"H:\\projects\\rust\\src/llvm-project/libunwind\\include"` to `"H:\\projects\\rust\\src\\llvm-project\\libunwind\\include"`
- include `libunwind/src`, some of the includes are located inside `src` and without this change the build fails with:
```
running: "h:/msys64/clang64/bin/clang++.exe" "-O3" "-ffunction-sections" "-fdata-sections" "--target=x86_64-pc-windows-gnullvm" "-I" "H:\\projects\\rust\\src\\llvm-project\\libunwind\\include" "-nostdinc++" "-fno-exceptions" "-fno-rtti" "-fstrict-aliasing" "-funwind-tables" "-fvisibility=hidden" "-fvisibility-global-new-delete-hidden" "-D_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS" "-D_LIBUNWIND_HIDE_SYMBOLS=1" "-D_LIBUNWIND_IS_NATIVE_ONLY=1" "-o" "H:\\projects\\rust\\build\\x86_64-pc-windows-gnullvm\\native\\libunwind\\Unwind-EHABI.o" "-c" "\\\\?\\H:\\projects\\rust\\src\\llvm-project\\libunwind\\src\\Unwind-EHABI.cpp"
cargo:warning=\\?\H:\projects\rust\src\llvm-project\libunwind\src\Unwind-EHABI.cpp:12:10: fatal error: 'Unwind-EHABI.h' file not found
cargo:warning=   12 | #include "Unwind-EHABI.h"
cargo:warning=      |          ^~~~~~~~~~~~~~~~
cargo:warning=1 error generated.
    exit code: 1
```
  • Loading branch information
bors committed Mar 5, 2024
2 parents bdde2a8 + fd2b23b commit e6c1f68
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ fn copy_third_party_objects(
}

if target == "x86_64-fortanix-unknown-sgx"
|| target.contains("pc-windows-gnullvm")
|| builder.config.llvm_libunwind(target) == LlvmLibunwind::InTree
&& (target.contains("linux") || target.contains("fuchsia"))
{
Expand Down
3 changes: 2 additions & 1 deletion src/bootstrap/src/core/build_steps/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1237,7 +1237,7 @@ impl Step for Libunwind {
}

let out_dir = builder.native_dir(self.target).join("libunwind");
let root = builder.src.join("src/llvm-project/libunwind");
let root = builder.src.join("src").join("llvm-project").join("libunwind");

if up_to_date(&root, &out_dir.join("libunwind.a")) {
return out_dir;
Expand Down Expand Up @@ -1271,6 +1271,7 @@ impl Step for Libunwind {
cfg.flag("-fvisibility=hidden");
cfg.define("_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS", None);
cfg.include(root.join("include"));
cfg.include(root.join("src"));
cfg.cargo_metadata(false);
cfg.out_dir(&out_dir);

Expand Down

0 comments on commit e6c1f68

Please sign in to comment.