Skip to content

Commit

Permalink
put weak mem* symbols behind an opt-in Cargo feature
Browse files Browse the repository at this point in the history
closes #64
cc #66
  • Loading branch information
Jorge Aparicio committed Sep 22, 2016
1 parent b46719e commit b7fa7d3
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,20 @@ matrix:
os: linux
- env: TARGET=thumbv6m-none-eabi
os: linux
- env: TARGET=thumbv6m-none-eabi WEAK=true
os: linux
- env: TARGET=thumbv7em-none-eabi
os: linux
- env: TARGET=thumbv7em-none-eabi WEAK=true
os: linux
- env: TARGET=thumbv7em-none-eabihf
os: linux
- env: TARGET=thumbv7em-none-eabihf WEAK=true
os: linux
- env: TARGET=thumbv7m-none-eabi
os: linux
- env: TARGET=thumbv7m-none-eabi WEAK=true
os: linux
- env: TARGET=x86_64-apple-darwin
language: ruby
os: osx
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ rand = "0.3.14"
path = "gcc_s"

[features]
default = ["rlibc/weak"]
weak = ["rlibc/weak"]

[workspace]
25 changes: 20 additions & 5 deletions ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ gist_it() {
}

build() {
$CARGO build --target $TARGET
$CARGO build --target $TARGET --release
if [[ $WEAK ]]; then
$CARGO build --features weak --target $TARGET
$CARGO build --features weak --target $TARGET --release
else
$CARGO build --target $TARGET
$CARGO build --target $TARGET --release
fi
}

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

# Check presence of weak symbols
if [[ $LINUX ]]; then
# Check presence/absence of weak symbols
if [[ $WEAK ]]; then
local symbols=( memcmp memcpy memmove memset )
for symbol in "${symbols[@]}"; do
$PREFIX$NM target/**/debug/deps/librlibc*.rlib | grep -q "W $symbol"
$PREFIX$NM target/$TARGET/debug/deps/librlibc-*.rlib | grep -q "W $symbol"
done
else
set +e
ls target/$TARGET/debug/deps/librlibc-*.rlib

if [[ $? == 0 ]]; then
exit 1
fi

set -e
fi

}
Expand All @@ -50,6 +64,7 @@ main() {
-e TRAVIS_BRANCH=$TRAVIS_BRANCH \
-e TRAVIS_COMMIT=$TRAVIS_COMMIT \
-e TRAVIS_OS_NAME=$TRAVIS_OS_NAME \
-e WEAK=$WEAK \
-v $(pwd):/mnt \
japaric/rustc-builtins \
sh -c 'cd /mnt;
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extern crate gcc_s;
#[cfg(test)]
extern crate rand;

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

pub mod int;
Expand Down

0 comments on commit b7fa7d3

Please sign in to comment.