Skip to content

Commit 89594e1

Browse files
author
Jorge Aparicio
authored
Merge pull request #29 from japaric/weak-memcpy
add weak `memcpy` et al symbols
2 parents adfb1ff + ac352a3 commit 89594e1

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

Cargo.toml

+6
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,11 @@ authors = ["Jorge Aparicio <[email protected]>"]
33
name = "rustc_builtins"
44
version = "0.1.0"
55

6+
[dependencies]
7+
rlibc = { git = "https://github.com/alexcrichton/rlibc", optional = true }
8+
69
[dev-dependencies]
710
quickcheck = "0.3.1"
11+
12+
[features]
13+
default = ["rlibc/weak"]

ci/script.sh

+11
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,21 @@ build() {
99

1010
inspect() {
1111
$PREFIX$NM -g --defined-only target/**/debug/*.rlib
12+
1213
set +e
1314
$PREFIX$OBJDUMP -Cd target/**/debug/*.rlib
1415
$PREFIX$OBJDUMP -Cd target/**/release/*.rlib
1516
set -e
17+
18+
# Check presence of weak symbols
19+
case $TRAVIS_OS_NAME in
20+
linux)
21+
local symbols=( memcmp memcpy memmove memset )
22+
for symbol in "${symbols[@]}"; do
23+
$PREFIX$NM target/**/debug/deps/librlibc*.rlib | grep -q "W $symbol"
24+
done
25+
;;
26+
esac
1627
}
1728

1829
run_tests() {

src/lib.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
#![allow(unused_features)]
21
#![feature(asm)]
32
#![feature(core_intrinsics)]
3+
#![feature(linkage)]
44
#![feature(naked_functions)]
55
#![cfg_attr(not(test), no_std)]
6+
#![no_builtins]
67
// TODO(rust-lang/rust#35021) uncomment when that PR lands
78
// #![feature(rustc_builtins)]
89

@@ -16,6 +17,9 @@ extern crate quickcheck;
1617
#[cfg(test)]
1718
extern crate core;
1819

20+
#[cfg(all(not(windows), not(target_os = "macos")))]
21+
extern crate rlibc;
22+
1923
#[cfg(target_arch = "arm")]
2024
pub mod arm;
2125

0 commit comments

Comments
 (0)