fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.9 KiB38 linesraw
1# ignore-cross-compile
2# ignore-windows-msvc
3
4include ../tools.mk
5
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# Except on Windows where piping/IO redirection under MSYS2 is wonky with llvm-nm.
9ifndef IS_WINDOWS
10NM = "$(LLVM_BIN_DIR)"/llvm-nm
11else
12NM = nm
13endif
14
15all: $(call NATIVE_STATICLIB,native-staticlib)
16	# Build a staticlib and a rlib, the `native_func` symbol will be bundled into them
17	$(RUSTC) bundled.rs --crate-type=staticlib --crate-type=rlib
18	$(NM) $(TMPDIR)/libbundled.a | $(CGREP) -e "T _*native_func"
19	$(NM) $(TMPDIR)/libbundled.a | $(CGREP) -e "U _*native_func"
20	$(NM) $(TMPDIR)/libbundled.rlib | $(CGREP) -e "T _*native_func"
21	$(NM) $(TMPDIR)/libbundled.rlib | $(CGREP) -e "U _*native_func"
22
23	# Build a staticlib and a rlib, the `native_func` symbol will not be bundled into it
24	$(RUSTC) non-bundled.rs --crate-type=staticlib --crate-type=rlib
25	$(NM) $(TMPDIR)/libnon_bundled.a | $(CGREP) -ve "T _*native_func"
26	$(NM) $(TMPDIR)/libnon_bundled.a | $(CGREP) -e "U _*native_func"
27	$(NM) $(TMPDIR)/libnon_bundled.rlib | $(CGREP) -ve "T _*native_func"
28	$(NM) $(TMPDIR)/libnon_bundled.rlib | $(CGREP) -e "U _*native_func"
29
30	# Build a cdylib, `native-staticlib` will not appear on the linker line because it was bundled previously
31	# The cdylib will contain the `native_func` symbol in the end
32	$(RUSTC) cdylib-bundled.rs --crate-type=cdylib --print link-args | $(CGREP) -ve '-l[" ]*native-staticlib'
33	$(NM) $(call DYLIB,cdylib_bundled) | $(CGREP) -e "[Tt] _*native_func"
34
35	# Build a cdylib, `native-staticlib` will appear on the linker line because it was not bundled previously
36	# The cdylib will contain the `native_func` symbol in the end
37	$(RUSTC) cdylib-non-bundled.rs --crate-type=cdylib --print link-args | $(CGREP) -e '-l[" ]*native-staticlib'
38	$(NM) $(call DYLIB,cdylib_non_bundled) | $(CGREP) -e "[Tt] _*native_func"