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

Test with the 'c' feature enabled on CI #166

Merged
merged 48 commits into from
Jun 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
a137787
Test with the 'c' feature enabled on CI
alexcrichton Jun 22, 2017
2f2bb32
Use traits instead of macros for shift intrinsics
alexcrichton Jun 23, 2017
eeb44ab
Remove executable bit from mod.rs
alexcrichton Jun 23, 2017
275d103
Port mul intrinsics to traits
alexcrichton Jun 23, 2017
7886ae2
Port sdiv to traits + `intrinsics!`
alexcrichton Jun 23, 2017
d170421
Port udiv to the `intrinsics!` macro
alexcrichton Jun 23, 2017
12a0038
Fix the abi hack on windows
alexcrichton Jun 23, 2017
a4120ad
Try to fix linkage on windows
alexcrichton Jun 23, 2017
7f90c48
Test 64-bit linux
alexcrichton Jun 23, 2017
215fa06
More windows linkage guesses
alexcrichton Jun 23, 2017
1b78d79
Require the `compiler-builtins` target for the example
alexcrichton Jun 23, 2017
f0e5859
Build the intrinsics example separately
alexcrichton Jun 23, 2017
8abb0ab
Build tweaks
alexcrichton Jun 23, 2017
47ff813
Use more intrinsics on msvc
alexcrichton Jun 23, 2017
4c41b56
Fix use_c_shim_if
alexcrichton Jun 23, 2017
4540bd4
Fix travis intrinsics builds
alexcrichton Jun 23, 2017
0be8b20
Fix features needed for the intrinsics example
alexcrichton Jun 23, 2017
696b821
Enable `mem` for intrinsics on linux
alexcrichton Jun 23, 2017
560018c
Less verbose output on symbol check
alexcrichton Jun 23, 2017
93fed26
Remove executable bit from conv.rs
alexcrichton Jun 23, 2017
83d63ea
Convert float intrinsics to the `intrinsics!` macro
alexcrichton Jun 23, 2017
ac3715d
Remove defined intrinsics from build.rs
alexcrichton Jun 23, 2017
7c47450
Remove executable bit on arm.rs
alexcrichton Jun 23, 2017
5a444d5
Remove unused rust file
alexcrichton Jun 23, 2017
a16ebb0
Use `nm` to weed out panics
alexcrichton Jun 23, 2017
5172f8c
Tweak usage of C shims on MSVC
alexcrichton Jun 23, 2017
a839d53
Deal with floatdidf on x86_64
alexcrichton Jun 23, 2017
7de57cd
Handle aeabi aliasing
alexcrichton Jun 23, 2017
eabb6fa
Shore up docs in the macros module
alexcrichton Jun 23, 2017
635e519
Remove the travis cache
alexcrichton Jun 24, 2017
d513c92
Try testing MinGW targets
alexcrichton Jun 24, 2017
94bc995
Don't build chkstk on x86_64
alexcrichton Jun 24, 2017
b42d267
Don't compile assembly on x86_64 Windows
alexcrichton Jun 24, 2017
4dac0be
Don't derive Debug for Sign
alexcrichton Jun 24, 2017
a2bdb4b
Use the same CI script on AppVeyor
alexcrichton Jun 24, 2017
2147753
Remove usage of unwrap_or_else
alexcrichton Jun 24, 2017
5e28b7e
Try to fix run.sh on AppVeyor
alexcrichton Jun 24, 2017
7643048
Fix appveyor PATH
alexcrichton Jun 24, 2017
734ec3d
Tweak testing and such:
alexcrichton Jun 24, 2017
5d6d3fd
Add a FIXME for Windows
alexcrichton Jun 24, 2017
91b1291
Don't try to work with `cargo test`
alexcrichton Jun 24, 2017
d051480
Don't generate unmangled aeabi with gen-tests
alexcrichton Jun 24, 2017
4859aba
Don't build gcc_personality_v0
alexcrichton Jun 24, 2017
acaa2f0
Don't check for references to panics with debug assertions
alexcrichton Jun 24, 2017
5c74fb1
Enable 128-bit integer tests on Windows
alexcrichton Jun 24, 2017
c193113
Don't test mangled names on thumb
alexcrichton Jun 24, 2017
afe5c71
Address review comments
alexcrichton Jun 25, 2017
0ebbcae
Enable the `intrinsics` program on thumb
alexcrichton Jun 25, 2017
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
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cache: cargo
dist: trusty
language: rust
rust: nightly
Expand Down Expand Up @@ -28,7 +27,7 @@ matrix:
- env: TARGET=thumbv7m-linux-eabi
- env: TARGET=x86_64-apple-darwin
os: osx
env: TARGET=x86_64-unknown-linux-gnu
- env: TARGET=x86_64-unknown-linux-gnu

before_install:
- test "$TRAVIS_OS_NAME" = "osx" || docker run --rm --privileged multiarch/qemu-user-static:register
Expand All @@ -52,8 +51,6 @@ script:
else
sh ci/run.sh $TARGET;
fi
# Travis can't cache files that are not readable by "others"
- chmod -R a+r $HOME/.cargo

notifications:
email:
Expand Down
10 changes: 9 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,22 @@ compiler-builtins = []
default = ["compiler-builtins"]
mem = []
rustbuild = ["compiler-builtins"]
mangled-names = []

# generate tests
#
# Note that this is an internal-only feature used in testing, this should not
# be relied on with crates.io! Enabling this may expose you to breaking
# changes.
gen-tests = ["cast", "rand"]

[target.'cfg(all(target_arch = "arm", not(any(target_env = "gnu", target_env = "musl")), target_os = "linux"))'.dev-dependencies]
test = { git = "https://github.com/japaric/utest" }
utest-cortex-m-qemu = { default-features = false, git = "https://github.com/japaric/utest" }
utest-macros = { git = "https://github.com/japaric/utest" }


[[example]]
name = "intrinsics"
required-features = ["c", "compiler-builtins"]

[workspace]
36 changes: 30 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,45 @@
environment:
# It's... a little unclear why the memcpy symbols clash on linux but not on
# other platforms. Would be great to not differ on this though!
INTRINSICS_FAILS_WITH_MEM_FEATURE: 1

matrix:
- TARGET: i686-pc-windows-msvc
- TARGET: x86_64-pc-windows-msvc

# Ensure MinGW works, but we need to download the 32-bit MinGW compiler from a
# custom location.
#
# Note that the MinGW builds have tons of references to
# `rust_eh_unwind_resume` in the debug LTO builds that aren't optimized out,
# so we skip that test for now. Would be great to not skip it!
- TARGET: i686-pc-windows-gnu
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
MINGW_ARCHIVE: i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z
MINGW_DIR: mingw32
DEBUG_LTO_BUILD_DOESNT_WORK: 1
- TARGET: x86_64-pc-windows-gnu
DEBUG_LTO_BUILD_DOESNT_WORK: 1

install:
- git submodule update --init
- curl -sSf -o rustup-init.exe https://win.rustup.rs
- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
- rustup-init.exe --default-host x86_64-pc-windows-msvc --default-toolchain nightly -y
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
- if "%TARGET%"=="i686-pc-windows-msvc" ( rustup target add %TARGET% )
- if NOT "%TARGET%" == "x86_64-pc-windows-msvc" rustup target add %TARGET%

# Use the system msys
- set PATH=C:\msys64\mingw64\bin;C:\msys64\usr\bin;%PATH%

# download a custom compiler otherwise
- if defined MINGW_URL appveyor DownloadFile %MINGW_URL%/%MINGW_ARCHIVE%
- if defined MINGW_URL 7z x -y %MINGW_ARCHIVE% > nul
- if defined MINGW_URL set PATH=C:\Python27;%CD%\%MINGW_DIR%\bin;C:\msys64\usr\bin;%PATH%

- rustc -Vv
- cargo -V

build: false

test_script:
- cargo build --target %TARGET%
- cargo build --release --target %TARGET%
- cargo test --no-default-features --features gen-tests --target %TARGET%
- cargo test --no-default-features --features gen-tests --release --target %TARGET%
- sh ci/run.sh %TARGET%
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What?! You can use bash on Windows / AppVeyor? I have been doing it wrong all this time ...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌠

64 changes: 14 additions & 50 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4066,28 +4066,8 @@ mod c {
"divxc3.c",
"extendsfdf2.c",
"extendhfsf2.c",
"ffsdi2.c",
"fixdfdi.c",
"fixdfsi.c",
"fixsfdi.c",
"fixsfsi.c",
"fixunsdfdi.c",
"fixunsdfsi.c",
"fixunssfdi.c",
"fixunssfsi.c",
"fixunsxfdi.c",
"fixunsxfsi.c",
"fixxfdi.c",
"floatdidf.c",
"floatdisf.c",
"floatdixf.c",
"floatsidf.c",
"floatsisf.c",
"floatundidf.c",
"floatundisf.c",
"floatundixf.c",
"floatunsidf.c",
"floatunsisf.c",
"int_util.c",
"muldc3.c",
"muldf3.c",
Expand Down Expand Up @@ -4124,18 +4104,6 @@ mod c {
"cmpti2.c",
"ctzti2.c",
"ffsti2.c",
"fixdfti.c",
"fixsfti.c",
"fixunsdfti.c",
"fixunssfti.c",
"fixunsxfti.c",
"fixxfti.c",
"floattidf.c",
"floattisf.c",
"floattixf.c",
"floatuntidf.c",
"floatuntisf.c",
"floatuntixf.c",
"mulvti3.c",
"negti2.c",
"negvti2.c",
Expand Down Expand Up @@ -4164,30 +4132,26 @@ mod c {
if target_arch == "x86_64" {
sources.extend(
&[
"x86_64/floatdidf.c",
"x86_64/floatdisf.c",
"x86_64/floatdixf.c",
],
);
}
} else {
if target_os != "freebsd" && target_os != "netbsd" {
sources.extend(&["gcc_personality_v0.c"]);
}

if target_arch == "x86_64" {
sources.extend(
&[
"x86_64/chkstk.S",
"x86_64/chkstk2.S",
"x86_64/floatdidf.c",
"x86_64/floatdisf.c",
"x86_64/floatdixf.c",
"x86_64/floatundidf.S",
"x86_64/floatundisf.S",
"x86_64/floatundixf.S",
],
);
// None of these seem to be used on x86_64 windows, and they've all
// got the wrong ABI anyway, so we want to avoid them.
if target_os != "windows" {
if target_arch == "x86_64" {
sources.extend(
&[
"x86_64/floatdisf.c",
"x86_64/floatdixf.c",
"x86_64/floatundidf.S",
"x86_64/floatundisf.S",
"x86_64/floatundixf.S",
],
);
}
}

if target_arch == "x86" {
Expand Down
101 changes: 68 additions & 33 deletions ci/run.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
set -ex

case $1 in
thumb*)
cargo=xargo
;;
*)
cargo=cargo
;;
esac

INTRINSICS_FEATURES="c"

# Some architectures like ARM apparently seem to require the `mem` feature
# enabled to successfully compile the `intrinsics` example, and... we're not
# sure why!
if [ -z "$INTRINSICS_FAILS_WITH_MEM_FEATURE" ]; then
INTRINSICS_FEATURES="$INTRINSICS_FEATURES mem"
fi

# Test our implementation
case $1 in
thumb*)
Expand Down Expand Up @@ -33,35 +51,14 @@ case $1 in
done
;;
*)
cargo test --no-default-features --features gen-tests --target $1
cargo test --no-default-features --features gen-tests --target $1 --release
run="cargo test --no-default-features --target $1"
$run --features 'gen-tests mangled-names'
$run --features 'gen-tests mangled-names' --release
$run --features 'gen-tests mangled-names c'
$run --features 'gen-tests mangled-names c' --release
;;
esac

# Verify that we haven't drop any intrinsic/symbol
case $1 in
thumb*)
xargo build --features c --target $1 --example intrinsics
;;
*)
cargo build --no-default-features --features c --target $1 --example intrinsics
;;
esac

# Verify that there are no undefined symbols to `panic` within our implementations
# TODO(#79) fix the undefined references problem for debug-assertions+lto
case $1 in
thumb*)
RUSTFLAGS="-C debug-assertions=no" xargo rustc --no-default-features --features c --target $1 --example intrinsics -- -C lto -C link-arg=-nostartfiles
xargo rustc --no-default-features --features c --target $1 --example intrinsics --release -- -C lto
;;
*)
RUSTFLAGS="-C debug-assertions=no" cargo rustc --no-default-features --features c --target $1 --example intrinsics -- -C lto
cargo rustc --no-default-features --features c --target $1 --example intrinsics --release -- -C lto
;;
esac

# Look out for duplicated symbols when we include the compiler-rt (C) implementation
PREFIX=$(echo $1 | sed -e 's/unknown-//')-
case $1 in
armv7-*)
Expand All @@ -75,7 +72,7 @@ case $1 in
;;
esac

case $TRAVIS_OS_NAME in
case "$TRAVIS_OS_NAME" in
osx)
# NOTE OSx's nm doesn't accept the `--defined-only` or provide an equivalent.
# Use GNU nm instead
Expand All @@ -87,22 +84,60 @@ case $TRAVIS_OS_NAME in
;;
esac

if [ $TRAVIS_OS_NAME = osx ]; then
path=target/${1}/debug/deps/libcompiler_builtins-*.rlib
else
if [ -d /target ]; then
path=/target/${1}/debug/deps/libcompiler_builtins-*.rlib
else
path=target/${1}/debug/deps/libcompiler_builtins-*.rlib
fi

# Look out for duplicated symbols when we include the compiler-rt (C) implementation
for rlib in $(echo $path); do
stdout=$($PREFIX$NM -g --defined-only $rlib)
set +x
stdout=$($PREFIX$NM -g --defined-only $rlib 2>&1)

# NOTE On i586, It's normal that the get_pc_thunk symbol appears several times so ignore it
# NOTE On i586, It's normal that the get_pc_thunk symbol appears several
# times so ignore it
#
# FIXME(#167) - we shouldn't ignore `__builtin_cl` style symbols here.
set +e
echo "$stdout" | sort | uniq -d | grep -v __x86.get_pc_thunk | grep 'T __'
echo "$stdout" | \
sort | \
uniq -d | \
grep -v __x86.get_pc_thunk | \
grep -v __builtin_cl | \
grep 'T __'

if test $? = 0; then
exit 1
fi
set -ex
done

rm -f $path

# Verify that we haven't drop any intrinsic/symbol
RUSTFLAGS="-C debug-assertions=no" \
$cargo build --features "$INTRINSICS_FEATURES" --target $1 --example intrinsics -v

# Verify that there are no undefined symbols to `panic` within our
# implementations
#
# TODO(#79) fix the undefined references problem for debug-assertions+lto
if [ -z "$DEBUG_LTO_BUILD_DOESNT_WORK" ]; then
RUSTFLAGS="-C debug-assertions=no" \
$cargo rustc --features "$INTRINSICS_FEATURES" --target $1 --example intrinsics -- -C lto
fi
$cargo rustc --features "$INTRINSICS_FEATURES" --target $1 --example intrinsics --release -- -C lto

# Ensure no references to a panicking function
for rlib in $(echo $path); do
set +ex
$PREFIX$NM -u $rlib 2>&1 | grep panicking

if test $? = 0; then
exit 1
fi
set -ex
done

true
Loading