Skip to content

Commit 5d3cbfc

Browse files
committed
test
1 parent fca1575 commit 5d3cbfc

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

ci/run.sh

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,48 @@ CARGO_PROFILE_DEV_LTO=true \
122122
CARGO_PROFILE_RELEASE_LTO=true \
123123
cargo build --target "$target" --package builtins-test-intrinsics --release
124124

125-
for_each_rlib nm
125+
for_each_rlib nm -A
126126

127127
# Ensure no references to any symbols from core
128128
for_each_rlib "${symcheck[@]}" -- check-core-syms
129+
130+
131+
declare -a rlib_paths
132+
133+
# Set the `rlib_paths` global array to a list of all compiler-builtins rlibs
134+
update_rlib_paths() {
135+
if [ -d /builtins-target ]; then
136+
rlib_paths=( /builtins-target/"${target}"/debug/deps/libcompiler_builtins-*.rlib )
137+
else
138+
rlib_paths=( target/"${target}"/debug/deps/libcompiler_builtins-*.rlib )
139+
fi
140+
}
141+
142+
143+
update_rlib_paths
144+
for rlib in "${rlib_paths[@]}"; do
145+
set +x
146+
echo "================================================================"
147+
echo "checking $rlib for references to core"
148+
echo "================================================================"
149+
set -x
150+
151+
tmpdir="${CARGO_TARGET_DIR:-target}/tmp"
152+
test -d "$tmpdir" || mkdir "$tmpdir"
153+
defined="$tmpdir/defined_symbols.txt"
154+
undefined="$tmpdir/defined_symbols.txt"
155+
156+
$NM --quiet -U "$rlib" | grep 'T _ZN4core' | awk '{print $3}' | sort | uniq > "$defined"
157+
$NM --quiet -u "$rlib" | grep 'U _ZN4core' | awk '{print $2}' | sort | uniq > "$undefined"
158+
grep_has_results=0
159+
grep -v -F -x -f "$defined" "$undefined" && grep_has_results=1
160+
161+
if [ "$target" = "powerpc64-unknown-linux-gnu" ]; then
162+
echo "FIXME: powerpc64 fails these tests"
163+
elif [ "$grep_has_results" != 0 ]; then
164+
echo "error: found unexpected references to core"
165+
exit 1
166+
else
167+
echo "success; no references to core found"
168+
fi
169+
done

crates/symbol-check/src/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ fn verify_core_symbols(path: impl AsRef<Path>) {
117117
let mut undefined = Vec::new();
118118

119119
for_each_symbol(path, |sym, member| {
120+
if cfg!(wasm) {
121+
let info = SymInfo::new(&sym, member);
122+
println!("{info:?}");
123+
}
124+
120125
// Find only symbols from `core`
121126
if !sym.name().unwrap().contains("_ZN4core") {
122127
return;

0 commit comments

Comments
 (0)