]> git.lizzy.rs Git - rust.git/blob - tests/run-make/rlib-format-packed-bundled-libs/Makefile
Auto merge of #107443 - cjgillot:generator-less-query, r=compiler-errors
[rust.git] / tests / run-make / rlib-format-packed-bundled-libs / Makefile
1 -include ../../run-make-fulldeps/tools.mk
2
3 # ignore-cross-compile
4
5 # Make sure rlib format with -Zpacked_bundled_libs is correct.
6
7 # We're using the llvm-nm instead of the system nm to ensure it is compatible
8 # with the LLVM bitcode generated by rustc.
9 # Except on Windows where piping/IO redirection under MSYS2 is wonky with llvm-nm.
10 ifndef IS_WINDOWS
11 NM = "$(LLVM_BIN_DIR)"/llvm-nm
12 else
13 NM = nm
14 endif
15
16 all: $(call NATIVE_STATICLIB,native_dep_1) $(call NATIVE_STATICLIB,native_dep_2) $(call NATIVE_STATICLIB,native_dep_3)
17         $(RUSTC) rust_dep_up.rs --crate-type=rlib -Zpacked_bundled_libs
18         $(NM) $(TMPDIR)/librust_dep_up.rlib | $(CGREP) -e "U.*native_f2"
19         $(NM) $(TMPDIR)/librust_dep_up.rlib | $(CGREP) -e "U.*native_f3"
20         $(NM) $(TMPDIR)/librust_dep_up.rlib | $(CGREP) -e "T.*rust_dep_up"
21         $(AR) t $(TMPDIR)/librust_dep_up.rlib | $(CGREP) "native_dep_2"
22         $(AR) t $(TMPDIR)/librust_dep_up.rlib | $(CGREP) "native_dep_3"
23         $(RUSTC) rust_dep_local.rs --extern rlib=$(TMPDIR)/librust_dep_up.rlib -Zpacked_bundled_libs --crate-type=rlib
24         $(NM) $(TMPDIR)/librust_dep_local.rlib | $(CGREP) -e "U.*native_f1"
25         $(NM) $(TMPDIR)/librust_dep_local.rlib | $(CGREP) -e "T.*rust_dep_local"
26         $(AR) t $(TMPDIR)/librust_dep_local.rlib | $(CGREP) "native_dep_1"
27
28         # Make sure compiler doesn't use files, that it shouldn't know about.
29         rm $(TMPDIR)/*native_dep_*
30
31         $(RUSTC) main.rs --extern lib=$(TMPDIR)/librust_dep_local.rlib -o $(TMPDIR)/main.exe -Zpacked_bundled_libs --print link-args | $(CGREP) -e "native_dep_1.*native_dep_2.*native_dep_3"
32
33 ifndef IS_MSVC
34         $(NM) $(TMPDIR)/main.exe | $(CGREP) -e "T.*native_f1"
35         $(NM) $(TMPDIR)/main.exe | $(CGREP) -e "T.*native_f2"
36         $(NM) $(TMPDIR)/main.exe | $(CGREP) -e "T.*native_f3"
37         $(NM) $(TMPDIR)/main.exe | $(CGREP) -e "T.*rust_dep_local"
38         $(NM) $(TMPDIR)/main.exe | $(CGREP) -e "T.*rust_dep_up"
39 endif