Skip to content
Open
Show file tree
Hide file tree
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
19 changes: 18 additions & 1 deletion library/unwind/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,28 @@ cfg_select! {
}
_ => {
#[link(name = "unwind", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
#[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
#[link(name = "gcc_s", cfg(all(not(target_feature = "crt-static"), not(target_arch = "hexagon"))))]
unsafe extern "C" {}
}
}

// Hexagon with musl uses llvm-libunwind by default
#[cfg(all(target_env = "musl", target_arch = "hexagon"))]
cfg_select! {
feature = "llvm-libunwind" => {
#[link(name = "unwind", kind = "static", modifiers = "-bundle")]
unsafe extern "C" {}
}
feature = "system-llvm-libunwind" => {
#[link(name = "unwind", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
#[link(name = "unwind", cfg(not(target_feature = "crt-static")))]
unsafe extern "C" {}
}
_ => {
// Fallback: should not happen since hexagon defaults to llvm-libunwind
}
}

// This is the same as musl except that we default to using the system libunwind
// instead of libgcc.
#[cfg(target_env = "ohos")]
Expand Down
5 changes: 4 additions & 1 deletion src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,10 @@ fn copy_third_party_objects(

if target == "x86_64-fortanix-unknown-sgx"
|| builder.config.llvm_libunwind(target) == LlvmLibunwind::InTree
&& (target.contains("linux") || target.contains("fuchsia") || target.contains("aix"))
&& (target.contains("linux")
|| target.contains("fuchsia")
|| target.contains("aix")
|| target.contains("hexagon"))
{
let libunwind_path =
copy_llvm_libunwind(builder, target, &builder.sysroot_target_libdir(*compiler, target));
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1851,7 +1851,7 @@ impl Config {
.get(&target)
.and_then(|t| t.llvm_libunwind)
.or(self.llvm_libunwind_default)
.unwrap_or(if target.contains("fuchsia") {
.unwrap_or(if target.contains("fuchsia") || target.contains("hexagon") {
LlvmLibunwind::InTree
} else {
LlvmLibunwind::No
Expand Down
Loading