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

CI: Use llvm-tools-preview instead of external llvm-tools for symbol prefix testing #1908

Merged
merged 3 commits into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
36 changes: 17 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -285,15 +285,14 @@ 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') }}
run: mk/check-symbol-prefixes.sh --target=${{ matrix.target }}

- 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' || 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:
# Don't run duplicate `push` jobs for the repo owner's PRs.
Expand Down Expand Up @@ -414,16 +413,14 @@ 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') }}
run: mk/check-symbol-prefixes.sh --target=${{ matrix.target }}

- 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' || 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
# an additional `webdriver` dimension.
Expand Down Expand Up @@ -477,7 +474,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.
Expand Down
26 changes: 16 additions & 10 deletions mk/check-symbol-prefixes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,21 @@
set -eux -o pipefail
IFS=$'\n\t'

case "$OSTYPE" in
darwin*)
nm_exe=nm
;;
*)
llvm_version=16
nm_exe=llvm-nm-$llvm_version
;;
esac
for arg in $*; do
case $arg in
--target=*)
target=${arg#*=}
;;
+*)
toolchain=${arg#*+}
;;
*)
;;
esac
done

# 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.
Expand All @@ -35,7 +41,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
Expand Down