From 698010b8bc7b552acab02c2de05787f604f81aa2 Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Tue, 6 Nov 2018 18:37:27 +0100 Subject: [PATCH] verify that jemallocator contains no std symbols --- .travis.yml | 17 +++++++++-------- ci/run.sh | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3a34bbc..bc3f925 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,7 +47,7 @@ matrix: env: TARGET=powerpc64le-unknown-linux-gnu NO_JEMALLOC_TESTS=1 - name: "x86_64-unknown-linux-gnu (nightly)" env: TARGET=x86_64-unknown-linux-gnu VALGRIND=1 JEMALLOC_SYS_VERIFY_CONFIGURE=1 - install: true + install: rustup component add llvm-tools-preview addons: &valgrind apt: packages: @@ -56,12 +56,12 @@ matrix: - name: "x86_64-unknown-linux-gnu (beta)" env: TARGET=x86_64-unknown-linux-gnu VALGRIND=1 rust: beta - install: true + install: rustup component add llvm-tools-preview addons: *valgrind - name: "x86_64-unknown-linux-gnu (stable)" env: TARGET=x86_64-unknown-linux-gnu VALGRIND=1 rust: stable - install: true + install: rustup component add llvm-tools-preview addons: *valgrind - name: "x86_64-unknown-linux-musl" env: TARGET=x86_64-unknown-linux-musl NOBGT=1 NO_JEMALLOC_TESTS=1 @@ -96,19 +96,19 @@ matrix: env: TARGET=x86_64-apple-darwin NO_JEMALLOC_TESTS=1 JEMALLOC_SYS_VERIFY_CONFIGURE=1 os: osx osx_image: xcode10 - install: true + install: rustup component add llvm-tools-preview - name: "x86_64-apple-darwin (beta)" env: TARGET=x86_64-apple-darwin NO_JEMALLOC_TESTS=1 os: osx osx_image: xcode10 rust: beta - install: true + install: rustup component add llvm-tools-preview - name: "x86_64-apple-darwin (stable)" env: TARGET=x86_64-apple-darwin NO_JEMALLOC_TESTS=1 os: osx osx_image: xcode10 rust: stable - install: true + install: rustup component add llvm-tools-preview # TOOLING - name: "Documentation" @@ -132,8 +132,9 @@ matrix: install: true script: shellcheck ci/*.sh -install: rustup target add ${TARGET} -script: ci/run.sh +install: + - rustup target add ${TARGET} +script: sh ci/run.sh env: global: - secure: "2Z1z4ir++XEQb9eegYTMolsNfTo1aATric2k4KfvRgnG1nAvvccf1Jg0828PVeqqD6w5f+X52AVT4bTDXbSL5L+/cTiBuVmY3943nyNOgHxFBTbVlnLtGnh18bb7AQAhyH1L9KjiLptMtFUfIg3TQ9r0QS+cBEJMFiE8BuuQMq/uPZYF3QMuV8W+9AwnqZPgdZV4q7LRnx2gHyVKifRfa4v0TxJA+fY5euON8CKemw12yVTZyNS5WUq6GLvQa5KsSYOSAIYizxz8Mze8plQytc6VhF3OuFyJ72u5LAx+szyxIu8zNAkyNeUqI1/V1gnlhWbZfov6KV56qoV9U8+xKp1J/nCXdabHEO/saOgWk4XgSSc7JNsT1PMPKT18r7JwNha0DS2onWBbegYMV0YXyH/WVAM+oXvhZAj7WPz5bHRbgkatGmBZD2jOjRQxzSugJsZzsmrKbWm8lIoyJGdNxTn5CisYElZvP1CV1OFaQBkaLfmnlpbJ0NQXpQdnpgXuLvI7sXptyn0Bjt41JQclB2BU98SrEiR0hPlkh8m4fH/QpQ8WdXEtvKXTX8UtG5RPW0UvTZVZtrU4Weyu2Hctj2D/hkXywtBXp7mUhB21fBGiaEc+vh6Q2OrZPrwoAj3YWfLlNBjFmfKmUwXXLno4FLLUujFmmypgs4Qit5HtzwQ=" diff --git a/ci/run.sh b/ci/run.sh index c93078f..98bff42 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -53,6 +53,24 @@ then esac fi +if [ "${TARGET}" = "x86_64-unknown-linux-gnu" ] || [ "${TARGET}" = "x86_64-apple-darwin" ] +then + ${CARGO_CMD} build -vv --target "${TARGET}" 2>&1 | tee build_no_std.txt + + # Check that the no-std builds are not linked against a libc with default + # features or the `use_std` feature enabled: + ! grep -q "default" build_no_std.txt + ! grep -q "use_std" build_no_std.txt + + RUST_SYS_ROOT=$(rustc --target="${TARGET}" --print sysroot) + RUST_LLVM_NM="${RUST_SYS_ROOT}/lib/rustlib/${TARGET}/bin/llvm-nm" + + find target/ -iname '*jemalloc*.rlib' | while read -r rlib; do + echo "${RUST_LLVM_NM} ${rlib}" + ! $RUST_LLVM_NM "${rlib}" | grep "std" + done +fi + ${CARGO_CMD} test -vv --target "${TARGET}" ${CARGO_CMD} test -vv --target "${TARGET}" --features profiling ${CARGO_CMD} test -vv --target "${TARGET}" --features debug