Rollup merge of #150009 - androm3da:bcain/hex_unwind, r=Mark-Simulacrum
Enable llvm-libunwind by default for Hexagon targets Fixes library linking issues where libgcc_s was incorrectly being linked instead of the appropriate LLVM runtime libraries for Hexagon targets. * Set llvm-libunwind as default for all hexagon targets in bootstrap * Exclude hexagon from automatic libgcc_s linking in unwind * Enable libunwind.a copying for hexagon targets * Remove manual library linking from hexagon target specification
This commit is contained in:
commit
99cc3799b5
3 changed files with 23 additions and 3 deletions
|
|
@ -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")]
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -1856,7 +1856,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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue