Skip to content

Commit 17581a7

Browse files
committed
Auto merge of #98573 - krasimirgg:nlmb-llvm-nm, r=nikic
adapt native-link-modifier-bundle test to use llvm-nm No functional changes intended. This updates the test case to use `llvm-nm` as an alternative to #98424. This fixes a test failure over at the experimental build of rustc with HEAD LLVM: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/11144#01814d0f-a46a-4c19-91cf-41e720edb6f9/684-691. The issue is that this test uses the system nm, which may not be recent enough to understand the bitcode produced by rustc when compiled against HEAD LLVM. Similar to what we did for another test in #94023.
2 parents d2074cb + aa4c8f6 commit 17581a7

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/test/run-make/native-link-modifier-bundle/Makefile

+14-10
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,31 @@
33

44
-include ../../run-make-fulldeps/tools.mk
55

6+
# We're using the llvm-nm instead of the system nm to ensure it is compatible
7+
# with the LLVM bitcode generated by rustc.
8+
NM = "$(LLVM_BIN_DIR)"/llvm-nm
9+
610
all: $(call NATIVE_STATICLIB,native-staticlib)
711
# Build a staticlib and a rlib, the `native_func` symbol will be bundled into them
812
$(RUSTC) bundled.rs --crate-type=staticlib --crate-type=rlib
9-
nm $(TMPDIR)/libbundled.a | $(CGREP) -e "T _*native_func"
10-
nm $(TMPDIR)/libbundled.a | $(CGREP) -e "U _*native_func"
11-
nm $(TMPDIR)/libbundled.rlib | $(CGREP) -e "T _*native_func"
12-
nm $(TMPDIR)/libbundled.rlib | $(CGREP) -e "U _*native_func"
13+
$(NM) $(TMPDIR)/libbundled.a | $(CGREP) -e "T _*native_func"
14+
$(NM) $(TMPDIR)/libbundled.a | $(CGREP) -e "U _*native_func"
15+
$(NM) $(TMPDIR)/libbundled.rlib | $(CGREP) -e "T _*native_func"
16+
$(NM) $(TMPDIR)/libbundled.rlib | $(CGREP) -e "U _*native_func"
1317

1418
# Build a staticlib and a rlib, the `native_func` symbol will not be bundled into it
1519
$(RUSTC) non-bundled.rs --crate-type=staticlib --crate-type=rlib
16-
nm $(TMPDIR)/libnon_bundled.a | $(CGREP) -ve "T _*native_func"
17-
nm $(TMPDIR)/libnon_bundled.a | $(CGREP) -e "U _*native_func"
18-
nm $(TMPDIR)/libnon_bundled.rlib | $(CGREP) -ve "T _*native_func"
19-
nm $(TMPDIR)/libnon_bundled.rlib | $(CGREP) -e "U _*native_func"
20+
$(NM) $(TMPDIR)/libnon_bundled.a | $(CGREP) -ve "T _*native_func"
21+
$(NM) $(TMPDIR)/libnon_bundled.a | $(CGREP) -e "U _*native_func"
22+
$(NM) $(TMPDIR)/libnon_bundled.rlib | $(CGREP) -ve "T _*native_func"
23+
$(NM) $(TMPDIR)/libnon_bundled.rlib | $(CGREP) -e "U _*native_func"
2024

2125
# Build a cdylib, `native-staticlib` will not appear on the linker line because it was bundled previously
2226
# The cdylib will contain the `native_func` symbol in the end
2327
$(RUSTC) cdylib-bundled.rs --crate-type=cdylib --print link-args | $(CGREP) -ve '-l[" ]*native-staticlib'
24-
nm $(call DYLIB,cdylib_bundled) | $(CGREP) -e "[Tt] _*native_func"
28+
$(NM) $(call DYLIB,cdylib_bundled) | $(CGREP) -e "[Tt] _*native_func"
2529

2630
# Build a cdylib, `native-staticlib` will appear on the linker line because it was not bundled previously
2731
# The cdylib will contain the `native_func` symbol in the end
2832
$(RUSTC) cdylib-non-bundled.rs --crate-type=cdylib --print link-args | $(CGREP) -e '-l[" ]*native-staticlib'
29-
nm $(call DYLIB,cdylib_non_bundled) | $(CGREP) -e "[Tt] _*native_func"
33+
$(NM) $(call DYLIB,cdylib_non_bundled) | $(CGREP) -e "[Tt] _*native_func"

0 commit comments

Comments
 (0)