about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-07-04 15:59:44 +0000
committerbors <bors@rust-lang.org>2022-07-04 15:59:44 +0000
commit17581a79adb7b1c064222defa94a5a3d79f5bfb2 (patch)
tree11c705ee21cb979ae33c54157496da4d10687ce0
parentd2074cbeeceb8b28fb6249a9aa3c937fe1c0bb92 (diff)
parentaa4c8f6fab6dd2dc3ed997815a7e6813dc6968e8 (diff)
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 https://github.com/rust-lang/rust/pull/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 https://github.com/rust-lang/rust/pull/94023.
-rw-r--r--src/test/run-make/native-link-modifier-bundle/Makefile24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/test/run-make/native-link-modifier-bundle/Makefile b/src/test/run-make/native-link-modifier-bundle/Makefile
index 723bb4689fe..e4b0f74ac26 100644
--- a/src/test/run-make/native-link-modifier-bundle/Makefile
+++ b/src/test/run-make/native-link-modifier-bundle/Makefile
@@ -3,27 +3,31 @@
 
 -include ../../run-make-fulldeps/tools.mk
 
+# We're using the llvm-nm instead of the system nm to ensure it is compatible
+# with the LLVM bitcode generated by rustc.
+NM = "$(LLVM_BIN_DIR)"/llvm-nm
+
 all: $(call NATIVE_STATICLIB,native-staticlib)
 	# Build a staticlib and a rlib, the `native_func` symbol will be bundled into them
 	$(RUSTC) bundled.rs --crate-type=staticlib --crate-type=rlib
-	nm $(TMPDIR)/libbundled.a | $(CGREP) -e "T _*native_func"
-	nm $(TMPDIR)/libbundled.a | $(CGREP) -e "U _*native_func"
-	nm $(TMPDIR)/libbundled.rlib | $(CGREP) -e "T _*native_func"
-	nm $(TMPDIR)/libbundled.rlib | $(CGREP) -e "U _*native_func"
+	$(NM) $(TMPDIR)/libbundled.a | $(CGREP) -e "T _*native_func"
+	$(NM) $(TMPDIR)/libbundled.a | $(CGREP) -e "U _*native_func"
+	$(NM) $(TMPDIR)/libbundled.rlib | $(CGREP) -e "T _*native_func"
+	$(NM) $(TMPDIR)/libbundled.rlib | $(CGREP) -e "U _*native_func"
 
 	# Build a staticlib and a rlib, the `native_func` symbol will not be bundled into it
 	$(RUSTC) non-bundled.rs --crate-type=staticlib --crate-type=rlib
-	nm $(TMPDIR)/libnon_bundled.a | $(CGREP) -ve "T _*native_func"
-	nm $(TMPDIR)/libnon_bundled.a | $(CGREP) -e "U _*native_func"
-	nm $(TMPDIR)/libnon_bundled.rlib | $(CGREP) -ve "T _*native_func"
-	nm $(TMPDIR)/libnon_bundled.rlib | $(CGREP) -e "U _*native_func"
+	$(NM) $(TMPDIR)/libnon_bundled.a | $(CGREP) -ve "T _*native_func"
+	$(NM) $(TMPDIR)/libnon_bundled.a | $(CGREP) -e "U _*native_func"
+	$(NM) $(TMPDIR)/libnon_bundled.rlib | $(CGREP) -ve "T _*native_func"
+	$(NM) $(TMPDIR)/libnon_bundled.rlib | $(CGREP) -e "U _*native_func"
 
 	# Build a cdylib, `native-staticlib` will not appear on the linker line because it was bundled previously
 	# The cdylib will contain the `native_func` symbol in the end
 	$(RUSTC) cdylib-bundled.rs --crate-type=cdylib --print link-args | $(CGREP) -ve '-l[" ]*native-staticlib'
-	nm $(call DYLIB,cdylib_bundled) | $(CGREP) -e "[Tt] _*native_func"
+	$(NM) $(call DYLIB,cdylib_bundled) | $(CGREP) -e "[Tt] _*native_func"
 
 	# Build a cdylib, `native-staticlib` will appear on the linker line because it was not bundled previously
 	# The cdylib will contain the `native_func` symbol in the end
 	$(RUSTC) cdylib-non-bundled.rs --crate-type=cdylib --print link-args | $(CGREP) -e '-l[" ]*native-staticlib'
-	nm $(call DYLIB,cdylib_non_bundled) | $(CGREP) -e "[Tt] _*native_func"
+	$(NM) $(call DYLIB,cdylib_non_bundled) | $(CGREP) -e "[Tt] _*native_func"