Auto merge of #73 - japaric:weak, r=japaric

put weak mem* symbols behind an opt-in Cargo feature

closes #64
cc #66
This commit is contained in:
homunkulus 2016-09-22 23:59:48 +00:00
commit c56a3f8a6e
4 changed files with 30 additions and 7 deletions

View File

@ -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

View File

@ -18,6 +18,6 @@ rand = "0.3.14"
path = "gcc_s"
[features]
default = ["rlibc/weak"]
weak = ["rlibc/weak"]
[workspace]

View File

@ -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() {
@ -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
}
@ -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;

View File

@ -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;