Disable libunwind cross-architecture unwinding

Building with _LIBUNWIND_IS_NATIVE_ONLY disables code for cross-architecture unwinding
it is disabled by default in LLVM [1], replicate the cmake behavior in bootstrap process

It also enables some additional code that handles PAC-specific unwind info
it helps compiling with the -mbranch-protection=pac or -mbranch-protection=standard flags

This fixes build with clang/musl on aarch64

[1] 85624c5de3

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj 2025-05-21 18:47:09 -07:00
parent 45f256d9d7
commit 56b669cd7a
No known key found for this signature in database
GPG key ID: BB053355919D3314

View file

@ -1430,6 +1430,7 @@ impl Step for Libunwind {
cfg.flag("-funwind-tables");
cfg.flag("-fvisibility=hidden");
cfg.define("_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS", None);
cfg.define("_LIBUNWIND_IS_NATIVE_ONLY", "1");
cfg.include(root.join("include"));
cfg.cargo_metadata(false);
cfg.out_dir(&out_dir);
@ -1447,12 +1448,10 @@ impl Step for Libunwind {
cfg.define("__NO_STRING_INLINES", None);
cfg.define("__NO_MATH_INLINES", None);
cfg.define("_LIBUNWIND_IS_BAREMETAL", None);
cfg.define("__LIBUNWIND_IS_NATIVE_ONLY", None);
cfg.define("NDEBUG", None);
}
if self.target.is_windows() {
cfg.define("_LIBUNWIND_HIDE_SYMBOLS", "1");
cfg.define("_LIBUNWIND_IS_NATIVE_ONLY", "1");
}
}