fork/rust

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

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

master
1.6 KiB35 linesraw
1include ../tools.mk
2
3# ignore-cross-compile
4# only-linux
5
6# Make sure -Zpacked_bundled_libs-like behavior activates with +bundle,+whole-archive.
7
8# We're using the llvm-nm instead of the system nm to ensure it is compatible
9# with the LLVM bitcode generated by rustc.
10NM = "$(LLVM_BIN_DIR)"/llvm-nm
11
12all: $(call NATIVE_STATICLIB,native_dep_1) $(call NATIVE_STATICLIB,native_dep_2) $(call NATIVE_STATICLIB,native_dep_3) $(call NATIVE_STATICLIB,native_dep_4)
13	# test cfg with packed bundle
14	$(RUSTC) rust_dep_cfg.rs --crate-type=rlib
15	$(RUSTC) main.rs --extern rust_dep=$(TMPDIR)/librust_dep_cfg.rlib --crate-type=staticlib --cfg should_add
16	$(AR) t $(TMPDIR)/librust_dep_cfg.rlib | $(CGREP) -e "libnative_dep_1.a"
17	$(AR) t $(TMPDIR)/librust_dep_cfg.rlib | $(CGREP) -e "libnative_dep_2.a"
18	$(AR) t $(TMPDIR)/libmain.a | $(CGREP) -e "libnative_dep_1.o"
19	$(AR) t $(TMPDIR)/libmain.a | $(CGREP) -ev "libnative_dep_2.o"
20
21
22	# test bundle with whole_archive
23	$(RUSTC) rust_dep.rs --crate-type=rlib
24	$(AR) t $(TMPDIR)/librust_dep.rlib | $(CGREP) -e "native_dep_1"
25	$(AR) t $(TMPDIR)/librust_dep.rlib | $(CGREP) -e "native_dep_3"
26	$(AR) t $(TMPDIR)/librust_dep.rlib | $(CGREP) -ev "native_dep_2"
27	$(AR) t $(TMPDIR)/librust_dep.rlib | $(CGREP) -ev "native_dep_4"
28
29	# Make sure compiler doesn't use files, that it shouldn't know about.
30	rm $(TMPDIR)/libnative_dep_1.a
31	rm $(TMPDIR)/libnative_dep_3.a
32
33	$(RUSTC) main.rs --extern rust_dep=$(TMPDIR)/librust_dep.rlib --print link-args > $(TMPDIR)/link_args
34	cat $(TMPDIR)/link_args | $(CGREP) -ev "native_dep_3"
35	cat $(TMPDIR)/link_args | $(CGREP) -e "--whole-archive.*native_dep_1.*--whole-archive.*lnative_dep_2.*no-whole-archive.*lnative_dep_4"