diff --git a/Cargo.toml b/Cargo.toml index dfd1fde..48f6ee0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,5 +3,11 @@ authors = ["Jorge Aparicio "] name = "rustc_builtins" version = "0.1.0" +[dependencies] +rlibc = { git = "https://github.com/alexcrichton/rlibc", optional = true } + [dev-dependencies] quickcheck = "0.3.1" + +[features] +default = ["rlibc/weak"] diff --git a/ci/script.sh b/ci/script.sh index 3b00ff6..7558478 100644 --- a/ci/script.sh +++ b/ci/script.sh @@ -9,10 +9,21 @@ build() { inspect() { $PREFIX$NM -g --defined-only target/**/debug/*.rlib + set +e $PREFIX$OBJDUMP -Cd target/**/debug/*.rlib $PREFIX$OBJDUMP -Cd target/**/release/*.rlib set -e + + # Check presence of weak symbols + case $TRAVIS_OS_NAME in + linux) + local symbols=( memcmp memcpy memmove memset ) + for symbol in "${symbols[@]}"; do + $PREFIX$NM target/**/debug/deps/librlibc*.rlib | grep -q "W $symbol" + done + ;; + esac } run_tests() { diff --git a/src/lib.rs b/src/lib.rs index 823170a..2263fda 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,9 @@ -#![allow(unused_features)] #![feature(asm)] #![feature(core_intrinsics)] +#![feature(linkage)] #![feature(naked_functions)] #![cfg_attr(not(test), no_std)] +#![no_builtins] // TODO(rust-lang/rust#35021) uncomment when that PR lands // #![feature(rustc_builtins)] @@ -16,6 +17,9 @@ extern crate quickcheck; #[cfg(test)] extern crate core; +#[cfg(all(not(windows), not(target_os = "macos")))] +extern crate rlibc; + #[cfg(target_arch = "arm")] pub mod arm;