Skip to content

Commit 6a2e7a1

Browse files
Merge #656: remove build.rs for android
Since rust-lang/rust#120593 the minimum android API level is 21. Related: https://github.com/android/ndk/wiki/Changelog-r26 rust-lang/rust#129305 1. stop setting `dl_iterate_phdr` based on whether the android API level is greater than or equal to 21, but retain it for back compat. 2. remove `cc` build dependency. 3. upgrade ndk r25b to r26d in CI.
2 parents fd0aed5 + 1f6cd98 commit 6a2e7a1

File tree

10 files changed

+10
-84
lines changed

10 files changed

+10
-84
lines changed

Cargo.lock

-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
name = "backtrace"
33
version = "0.3.73"
44
authors = ["The Rust Project Developers"]
5-
build = "build.rs"
65
license = "MIT OR Apache-2.0"
76
readme = "README.md"
87
repository = "https://github.com/rust-lang/backtrace-rs"
@@ -49,11 +48,6 @@ version = "0.36.0"
4948
default-features = false
5049
features = ['read_core', 'elf', 'macho', 'pe', 'xcoff', 'unaligned', 'archive']
5150

52-
[build-dependencies]
53-
# Only needed for Android, but cannot be target dependent
54-
# https://github.com/rust-lang/cargo/issues/4932
55-
cc = "1.0.97"
56-
5751
[dev-dependencies]
5852
dylib-dep = { path = "crates/dylib-dep" }
5953
libloading = "0.7"

build.rs

-55
This file was deleted.

ci/android-ndk.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
set -ex
22

33
ANDROID_NDK_URL=https://dl.google.com/android/repository
4-
ANDROID_NDK_ARCHIVE=android-ndk-r25b-linux.zip
4+
ANDROID_NDK_ARCHIVE=android-ndk-r26d-linux.zip
55

66
mkdir /android-toolchain
77
cd /android-toolchain

ci/docker/arm-linux-androideabi/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ RUN /android-ndk.sh
1414
ENV PATH=$PATH:/android-toolchain/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin
1515

1616
# TODO: run tests in an emulator eventually
17-
ENV CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=armv7a-linux-androideabi19-clang \
17+
ENV CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=armv7a-linux-androideabi21-clang \
1818
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER=echo

ci/docker/armv7-linux-androideabi/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ RUN /android-ndk.sh
1414
ENV PATH=$PATH:/android-toolchain/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin
1515

1616
# TODO: run tests in an emulator eventually
17-
ENV CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=armv7a-linux-androideabi19-clang \
17+
ENV CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=armv7a-linux-androideabi21-clang \
1818
CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_RUNNER=echo

ci/docker/i686-linux-android/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ RUN /android-ndk.sh
1414
ENV PATH=$PATH:/android-toolchain/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin
1515

1616
# TODO: run tests in an emulator eventually
17-
ENV CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android19-clang \
17+
ENV CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android21-clang \
1818
CARGO_TARGET_I686_LINUX_ANDROID_RUNNER=echo

crates/as-if-std/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ features = ['read_core', 'elf', 'macho', 'pe', 'xcoff', 'unaligned', 'archive']
2828

2929
[build-dependencies]
3030
# Dependency of the `backtrace` crate
31-
cc = "1.0.97"
3231
windows-bindgen = "0.56"
3332

3433
[features]

crates/as-if-std/build.rs

-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
// backtrace-rs requires a feature check on Android targets, so
2-
// we need to run its build.rs as well.
3-
#[allow(unused_extern_crates)]
4-
#[path = "../../build.rs"]
5-
mod backtrace_build_rs;
6-
71
fn main() {
82
println!("cargo:rustc-cfg=backtrace_in_libstd");
9-
10-
backtrace_build_rs::main();
113
}

src/symbolize/gimli.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl Mapping {
100100
// only borrow `map` and `stash` and we're preserving them below.
101101
cx: unsafe { core::mem::transmute::<Context<'_>, Context<'static>>(cx) },
102102
_map: data,
103-
stash: stash,
103+
stash,
104104
})
105105
}
106106
}
@@ -122,13 +122,11 @@ impl<'data> Context<'data> {
122122
if cfg!(not(target_os = "aix")) {
123123
let data = object.section(stash, id.name()).unwrap_or(&[]);
124124
Ok(EndianSlice::new(data, Endian))
125+
} else if let Some(name) = id.xcoff_name() {
126+
let data = object.section(stash, name).unwrap_or(&[]);
127+
Ok(EndianSlice::new(data, Endian))
125128
} else {
126-
if let Some(name) = id.xcoff_name() {
127-
let data = object.section(stash, name).unwrap_or(&[]);
128-
Ok(EndianSlice::new(data, Endian))
129-
} else {
130-
Ok(EndianSlice::new(&[], Endian))
131-
}
129+
Ok(EndianSlice::new(&[], Endian))
132130
}
133131
})
134132
.ok()?;
@@ -226,7 +224,7 @@ cfg_if::cfg_if! {
226224
target_os = "hurd",
227225
target_os = "openbsd",
228226
target_os = "netbsd",
229-
all(target_os = "android", feature = "dl_iterate_phdr"),
227+
target_os = "android",
230228
),
231229
not(target_env = "uclibc"),
232230
))] {

0 commit comments

Comments
 (0)