Skip to content

Commit 3c0768e

Browse files
committed
debug
1 parent bceea49 commit 3c0768e

File tree

2 files changed

+51
-12
lines changed

2 files changed

+51
-12
lines changed

ci/run.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,37 @@ else
4747
fi
4848
fi
4949

50+
PREFIX=${target//unknown-/}-
51+
case "$target" in
52+
armv7-*)
53+
PREFIX=arm-linux-gnueabihf-
54+
;;
55+
thumb*)
56+
PREFIX=arm-none-eabi-
57+
;;
58+
*86*-*)
59+
PREFIX=
60+
;;
61+
esac
62+
63+
cat << EOF > run-rust-nm
64+
NM=$(find "$(rustc --print sysroot)" \( -name llvm-nm -o -name llvm-nm.exe \) )
65+
if [ "$NM" = "" ]; then
66+
NM="${PREFIX}nm"
67+
fi
68+
69+
# i686-pc-windows-gnu tools have a dependency on some DLLs, so run it with
70+
# rustup run to ensure that those are in PATH.
71+
TOOLCHAIN="$(rustup show active-toolchain | sed 's/ (default)//')"
72+
if [[ "$TOOLCHAIN" == *i686-pc-windows-gnu ]]; then
73+
NM="rustup run $TOOLCHAIN $NM"
74+
fi
75+
76+
$NM "$@""
77+
EOF
78+
79+
chmod +x run-rust-nm
80+
5081
symcheck=(cargo run -p symbol-check)
5182
[[ "$target" = "wasm"* ]] && symcheck+=(--features wasm)
5283
symcheck+=(-- build-and-check)

crates/symbol-check/src/main.rs

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,25 @@ fn verify_no_duplicates(path: impl AsRef<Path>) {
129129
let mut dups = Vec::new();
130130
let mut found_any = false;
131131

132-
for_each_symbol(path, |sym, member| {
133-
// Only check defined globals, exclude wasm file symbols
134-
if !sym.is_global() || sym.is_undefined()
135-
// || sym.kind() == SymbolKind::File
136-
{
132+
for_each_symbol(&path, |sym, member| {
133+
// Only check defined globals
134+
if !sym.is_global() || sym.is_undefined() {
137135
return;
138136
}
139137

140138
let info = SymInfo::new(&sym, member);
139+
140+
// x86-32 includes multiple copies of thunk symbols
141141
if info.name.starts_with("__x86.get_pc_thunk") {
142-
// x86-32 includes multiple copies of thunk symbols
142+
return;
143+
}
144+
145+
// Ignore literal constants on Windows
146+
let win_allowed_dup_pfx = ["__real@", "__xmm@"];
147+
if win_allowed_dup_pfx
148+
.iter()
149+
.any(|pfx| info.name.starts_with(pfx))
150+
{
143151
return;
144152
}
145153

@@ -158,14 +166,14 @@ fn verify_no_duplicates(path: impl AsRef<Path>) {
158166

159167
assert!(found_any, "no symbols found");
160168

161-
if cfg!(windows) {
162-
// Ignore literal constants
163-
let allowed_dup_pfx = ["__real@", "__xmm@"];
164-
dups.retain(|sym| !allowed_dup_pfx.iter().any(|pfx| sym.name.starts_with(pfx)));
165-
}
166-
167169
if !dups.is_empty() {
168170
dups.sort_unstable_by(|a, b| a.name.cmp(&b.name));
171+
172+
Command::new("run-rust-nm")
173+
.arg(path.as_ref())
174+
.status()
175+
.unwrap();
176+
169177
panic!("found duplicate symbols: {dups:#?}");
170178
}
171179

0 commit comments

Comments
 (0)