From 486cf54701bf466dfea603700018dffdf07cef1a Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Sat, 13 Jan 2024 15:11:26 -0800 Subject: [PATCH 1/3] mk/check-symbol-prefixes.sh: Make target argument mandatory. --- mk/check-symbol-prefixes.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mk/check-symbol-prefixes.sh b/mk/check-symbol-prefixes.sh index 83e721b2f4..ad67d74ec5 100755 --- a/mk/check-symbol-prefixes.sh +++ b/mk/check-symbol-prefixes.sh @@ -17,6 +17,16 @@ set -eux -o pipefail IFS=$'\n\t' +for arg in $*; do + case $arg in + --target=*) + target=${arg#*=} + ;; + *) + ;; + esac +done + case "$OSTYPE" in darwin*) nm_exe=nm @@ -35,7 +45,7 @@ esac # # This is very liberal in filtering out symbols that "look like" # Rust-compiler-generated symbols. -find target -type f -name libring-*.rlib | while read -r infile; do +find target/$target -type f -name libring-*.rlib | while read -r infile; do bad=$($nm_exe --defined-only --extern-only --print-file-name "$infile" \ | ( grep -v -E " . _?(__imp__ZN4ring|ring_core_|__rustc|_ZN|DW.ref.rust_eh_personality)" || [[ $? == 1 ]] )) if [ ! -z "${bad-}" ]; then From 556f873c4aa8dc27bbdd00c4be85154bdca87051 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Tue, 19 Dec 2023 10:00:22 -0800 Subject: [PATCH 2/3] CI: mk/check-symbol-prefixes.sh: Use llvm-tools-preview llvm-nm. --- .github/workflows/ci.yml | 18 +++++++++++++++--- mk/check-symbol-prefixes.sh | 14 +++++--------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e9ef615f1..c02cc2c849 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -290,10 +290,16 @@ jobs: # Unknown attribute kind (528) # (Producer: 'LLVM12.0.0-rust-1.54.0-nightly' # Reader: 'LLVM APPLE_1_1200.0.32.29_0') + + - if: ${{ matrix.target != 'aarch64-apple-ios' && + !contains(matrix.host_os, 'windows') && + (!contains(matrix.host_os, 'macos') || matrix.mode != '--release') }} + run: rustup toolchain install --component=llvm-tools-preview ${{ matrix.rust_channel }} + - if: ${{ matrix.target != 'aarch64-apple-ios' && !contains(matrix.host_os, 'windows') && (!contains(matrix.host_os, 'macos') || matrix.mode != '--release') }} - run: mk/check-symbol-prefixes.sh --target=${{ matrix.target }} + run: mk/check-symbol-prefixes.sh +${{ matrix.rust_channel }} --target=${{ matrix.target }} test-bench: # Don't run duplicate `push` jobs for the repo owner's PRs. @@ -419,11 +425,16 @@ jobs: # Unknown attribute kind (528) # (Producer: 'LLVM12.0.0-rust-1.54.0-nightly' # Reader: 'LLVM APPLE_1_1200.0.32.29_0') + - if: ${{ matrix.target != 'aarch64-apple-ios' && !contains(matrix.host_os, 'windows') && (!contains(matrix.host_os, 'macos') || matrix.mode != '--release') }} - run: mk/check-symbol-prefixes.sh --target=${{ matrix.target }} + run: rustup toolchain install --component=llvm-tools-preview ${{ matrix.rust_channel }} + - if: ${{ matrix.target != 'aarch64-apple-ios' && + !contains(matrix.host_os, 'windows') && + (!contains(matrix.host_os, 'macos') || matrix.mode != '--release') }} + run: mk/check-symbol-prefixes.sh +${{ matrix.rust_channel }} --target=${{ matrix.target }} # The wasm32-unknown-unknown targets have a different set of feature sets and # an additional `webdriver` dimension. @@ -477,7 +488,8 @@ jobs: # Check that all the needed symbol renaming was done. # TODO: Do this check on Windows too. - - run: mk/check-symbol-prefixes.sh --target=${{ matrix.target }} + - run: rustup toolchain install --component=llvm-tools-preview ${{ matrix.rust_channel }} + - run: mk/check-symbol-prefixes.sh +${{ matrix.rust_channel }} --target=${{ matrix.target }} coverage: # Don't run duplicate `push` jobs for the repo owner's PRs. diff --git a/mk/check-symbol-prefixes.sh b/mk/check-symbol-prefixes.sh index ad67d74ec5..469ebb9db4 100755 --- a/mk/check-symbol-prefixes.sh +++ b/mk/check-symbol-prefixes.sh @@ -22,20 +22,16 @@ for arg in $*; do --target=*) target=${arg#*=} ;; + +*) + toolchain=${arg#*+} + ;; *) ;; esac done -case "$OSTYPE" in -darwin*) - nm_exe=nm - ;; -*) - llvm_version=16 - nm_exe=llvm-nm-$llvm_version - ;; -esac +# Use the host target-libdir, not the target target-libdir. +nm_exe=$(rustc +${toolchain} --print target-libdir)/../bin/llvm-nm # TODO: This should only look in one target directory. # TODO: This isn't as strict as it should be. From 3cb66f53bd5d027ba11dffbf6488a7621cd17f0d Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Sat, 13 Jan 2024 16:42:49 -0800 Subject: [PATCH 3/3] CI: Check symbol prefixes for Apple targets too. It doesn't seem to work with the 1.61.0 toolchain for iOS, so exclude that. --- .github/workflows/ci.yml | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c02cc2c849..f6cdf73a65 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -285,20 +285,13 @@ jobs: # Check that all the needed symbol renaming was done. # TODO: Do this check on Windows too. - # TODO: Check iOS too. - # TODO: Do this on Apple-hosted release builds too; currently these fail with: - # Unknown attribute kind (528) - # (Producer: 'LLVM12.0.0-rust-1.54.0-nightly' - # Reader: 'LLVM APPLE_1_1200.0.32.29_0') - - - if: ${{ matrix.target != 'aarch64-apple-ios' && - !contains(matrix.host_os, 'windows') && - (!contains(matrix.host_os, 'macos') || matrix.mode != '--release') }} + + - if: ${{ (matrix.target != 'aarch64-apple-ios' || matrix.rust_channel != '1.61.0') && + !contains(matrix.host_os, 'windows') }} run: rustup toolchain install --component=llvm-tools-preview ${{ matrix.rust_channel }} - - if: ${{ matrix.target != 'aarch64-apple-ios' && - !contains(matrix.host_os, 'windows') && - (!contains(matrix.host_os, 'macos') || matrix.mode != '--release') }} + - if: ${{ (matrix.target != 'aarch64-apple-ios' || matrix.rust_channel != '1.61.0') && + !contains(matrix.host_os, 'windows') }} run: mk/check-symbol-prefixes.sh +${{ matrix.rust_channel }} --target=${{ matrix.target }} test-bench: @@ -420,20 +413,13 @@ jobs: # Check that all the needed symbol renaming was done. # TODO: Do this check on Windows too. - # TODO: Check iOS too. - # TODO: Do this on Apple-hosted release builds too; currently these fail with: - # Unknown attribute kind (528) - # (Producer: 'LLVM12.0.0-rust-1.54.0-nightly' - # Reader: 'LLVM APPLE_1_1200.0.32.29_0') - - - if: ${{ matrix.target != 'aarch64-apple-ios' && - !contains(matrix.host_os, 'windows') && - (!contains(matrix.host_os, 'macos') || matrix.mode != '--release') }} + + - if: ${{ (matrix.target != 'aarch64-apple-ios' || matrix.rust_channel != '1.61.0') && + !contains(matrix.host_os, 'windows') }} run: rustup toolchain install --component=llvm-tools-preview ${{ matrix.rust_channel }} - - if: ${{ matrix.target != 'aarch64-apple-ios' && - !contains(matrix.host_os, 'windows') && - (!contains(matrix.host_os, 'macos') || matrix.mode != '--release') }} + - if: ${{ (matrix.target != 'aarch64-apple-ios' || matrix.rust_channel != '1.61.0') && + !contains(matrix.host_os, 'windows') }} run: mk/check-symbol-prefixes.sh +${{ matrix.rust_channel }} --target=${{ matrix.target }} # The wasm32-unknown-unknown targets have a different set of feature sets and