diff options
| author | Vojtech Kral <vojtech.kral@braiins.com> | 2019-10-30 17:51:43 +0100 |
|---|---|---|
| committer | Vojtech Kral <vojtech@kral.hk> | 2019-10-30 18:09:05 +0100 |
| commit | e9e483653223597db7db8b60187d78252ec77886 (patch) | |
| tree | d7da65af2af5eb4fceba99c38b2b6f3bdb00ae4e | |
| parent | c553e8e8812c19809e70523064989e66c5cfd3f1 (diff) | |
| download | rust-e9e483653223597db7db8b60187d78252ec77886.tar.gz rust-e9e483653223597db7db8b60187d78252ec77886.zip | |
Fix libunwind build: Define __LITTLE_ENDIAN__ for LE targets
If __LITTLE_ENDIAN__ is missing, libunwind assumes big endian and reads unwinding instructions wrong on ARM EHABI. Fix #65765
| -rw-r--r-- | src/libunwind/build.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libunwind/build.rs b/src/libunwind/build.rs index f24d957d67b..b8db16f8f2a 100644 --- a/src/libunwind/build.rs +++ b/src/libunwind/build.rs @@ -56,12 +56,18 @@ mod llvm_libunwind { pub fn compile() { let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap(); let target_vendor = env::var("CARGO_CFG_TARGET_VENDOR").unwrap(); + let target_endian_little = env::var("CARGO_CFG_TARGET_ENDIAN").unwrap() != "big"; let cfg = &mut cc::Build::new(); cfg.cpp(true); cfg.cpp_set_stdlib(None); cfg.warnings(false); + // libunwind expects a __LITTLE_ENDIAN__ macro to be set for LE archs, cf. #65765 + if target_endian_little { + cfg.define("__LITTLE_ENDIAN__", Some("1")); + } + if target_env == "msvc" { // Don't pull in extra libraries on MSVC cfg.flag("/Zl"); |
