Skip to content

Commit 66bb08b

Browse files
author
Jorge Aparicio
committed
put weak mem* symbols behind an opt-in Cargo feature
closes #64 cc #66
1 parent 9e50598 commit 66bb08b

File tree

4 files changed

+30
-7
lines changed

4 files changed

+30
-7
lines changed

.travis.yml

+8
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,20 @@ matrix:
3232
os: linux
3333
- env: TARGET=thumbv6m-none-eabi
3434
os: linux
35+
- env: TARGET=thumbv6m-none-eabi WEAK=true
36+
os: linux
3537
- env: TARGET=thumbv7em-none-eabi
3638
os: linux
39+
- env: TARGET=thumbv7em-none-eabi WEAK=true
40+
os: linux
3741
- env: TARGET=thumbv7em-none-eabihf
3842
os: linux
43+
- env: TARGET=thumbv7em-none-eabihf WEAK=true
44+
os: linux
3945
- env: TARGET=thumbv7m-none-eabi
4046
os: linux
47+
- env: TARGET=thumbv7m-none-eabi WEAK=true
48+
os: linux
4149
- env: TARGET=x86_64-apple-darwin
4250
language: ruby
4351
os: osx

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ rlibc = { git = "https://github.com/alexcrichton/rlibc", optional = true }
1010
quickcheck = "0.3.1"
1111

1212
[features]
13-
default = ["rlibc/weak"]
13+
weak = ["rlibc/weak"]

ci/script.sh

+20-5
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@ gist_it() {
88
}
99

1010
build() {
11-
$CARGO build --target $TARGET
12-
$CARGO build --target $TARGET --release
11+
if [[ $WEAK ]]; then
12+
$CARGO build --features weak --target $TARGET
13+
$CARGO build --features weak --target $TARGET --release
14+
else
15+
$CARGO build --target $TARGET
16+
$CARGO build --target $TARGET --release
17+
fi
1318
}
1419

1520
inspect() {
@@ -19,12 +24,21 @@ inspect() {
1924
$PREFIX$OBJDUMP -Cd target/**/release/*.rlib | gist_it
2025
set -e
2126

22-
# Check presence of weak symbols
23-
if [[ $LINUX ]]; then
27+
# Check presence/absence of weak symbols
28+
if [[ $WEAK ]]; then
2429
local symbols=( memcmp memcpy memmove memset )
2530
for symbol in "${symbols[@]}"; do
26-
$PREFIX$NM target/**/debug/deps/librlibc*.rlib | grep -q "W $symbol"
31+
$PREFIX$NM target/$TARGET/debug/deps/librlibc-*.rlib | grep -q "W $symbol"
2732
done
33+
else
34+
set +e
35+
ls target/$TARGET/debug/deps/librlibc-*.rlib
36+
37+
if [[ $? == 0 ]]; then
38+
exit 1
39+
fi
40+
41+
set -e
2842
fi
2943

3044
}
@@ -50,6 +64,7 @@ main() {
5064
-e TRAVIS_BRANCH=$TRAVIS_BRANCH \
5165
-e TRAVIS_COMMIT=$TRAVIS_COMMIT \
5266
-e TRAVIS_OS_NAME=$TRAVIS_OS_NAME \
67+
-e WEAK=$WEAK \
5368
-v $(pwd):/mnt \
5469
japaric/rustc-builtins \
5570
sh -c 'cd /mnt;

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ extern crate quickcheck;
1717
#[cfg(test)]
1818
extern crate core;
1919

20-
#[cfg(all(not(windows), not(target_os = "macos")))]
20+
#[cfg(feature = "weak")]
2121
extern crate rlibc;
2222

2323
pub mod int;

0 commit comments

Comments
 (0)