Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Sep 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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