about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2018-08-14 21:08:42 -0700
committerJosh Stone <jistone@redhat.com>2018-08-14 21:08:42 -0700
commite0d8364dadd404a37bc344ef089926745cfdbe20 (patch)
treeeb8b5105142a792a8b178eb038af7ba0bf10d7a3 /src/libstd
parentfa23350a469b4c762d6fc1cb492092d954f678c8 (diff)
downloadrust-e0d8364dadd404a37bc344ef089926745cfdbe20.tar.gz
rust-e0d8364dadd404a37bc344ef089926745cfdbe20.zip
std: Use target_pointer_width for BACKTRACE_ELF_SIZE
The former code used `target.contains("64")` to detect Elf64 targets,
but this is inaccurate in a few cases:

- `s390x-unknown-linux-gnu` is 64-bit
- `sparcv9-sun-solaris` is 64-bit
- `x86_64-unknown-linux-gnux32` is 32-bit

Instead the `std` build script can use `CARGO_CFG_TARGET_POINTER_WIDTH`
to reliably detect 64-bit targets for libbacktrace.

Also update to backtrace-sys 0.1.24 for alexcrichton/backtrace-rs#122.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/build.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libstd/build.rs b/src/libstd/build.rs
index 26d93f97e69..016e7adb4c9 100644
--- a/src/libstd/build.rs
+++ b/src/libstd/build.rs
@@ -104,7 +104,8 @@ fn build_libbacktrace(target: &str) -> Result<(), ()> {
     } else {
         build.file("../libbacktrace/elf.c");
 
-        if target.contains("64") {
+        let pointer_width = env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap();
+        if pointer_width == "64" {
             build.define("BACKTRACE_ELF_SIZE", "64");
         } else {
             build.define("BACKTRACE_ELF_SIZE", "32");