diff options
| author | Tyler Mandry <tmandry@gmail.com> | 2019-11-01 11:20:21 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-01 11:20:21 -0700 |
| commit | 05de0d7c9fce57456ec095cae5cd94cf50a13eba (patch) | |
| tree | 3d736b3a2e9e6b06ea7758561c93d6d216592f37 /src | |
| parent | 9bf161384097aca7bfe8c106f167df28092b34b4 (diff) | |
| parent | e9e483653223597db7db8b60187d78252ec77886 (diff) | |
| download | rust-05de0d7c9fce57456ec095cae5cd94cf50a13eba.tar.gz rust-05de0d7c9fce57456ec095cae5cd94cf50a13eba.zip | |
Rollup merge of #65972 - braiins:vkr-arm-panicking, r=alexcrichton
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 Technical background in referenced bug. I didn't run any automated tests, just built a simple panicking program using the fixed toolchain and panicking started to work. Tried with `catch_unwind()` and that seems to work now too. libunwind's log seems ok now, I can paste it if needed.
Diffstat (limited to 'src')
| -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"); |
