fork/rust

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

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

master
1.0 KiB34 linesraw
1# ignore-cross-compile
2include ../tools.mk
3
4# Test mixing pathless --extern with paths.
5
6# Test for static linking by checking that the binary runs if the dylib
7# is removed and test for dynamic linking by checking that the binary
8# fails to run if the dylib is removed.
9
10all:
11	$(RUSTC) bar.rs --crate-type=rlib --crate-type=dylib -Cprefer-dynamic
12
13	# rlib preferred over dylib
14	$(RUSTC) foo.rs --extern bar
15	mv $(call DYLIB,bar) $(TMPDIR)/bar.tmp
16	$(call RUN,foo)
17	mv $(TMPDIR)/bar.tmp $(call DYLIB,bar)
18
19	$(RUSTC) foo.rs --extern bar=$(TMPDIR)/libbar.rlib --extern bar
20	mv $(call DYLIB,bar) $(TMPDIR)/bar.tmp
21	$(call RUN,foo)
22	mv $(TMPDIR)/bar.tmp $(call DYLIB,bar)
23
24	# explicit --extern overrides pathless
25	$(RUSTC) foo.rs --extern bar=$(call DYLIB,bar) --extern bar
26	mv $(call DYLIB,bar) $(TMPDIR)/bar.tmp
27	$(call FAIL,foo)
28	mv $(TMPDIR)/bar.tmp $(call DYLIB,bar)
29
30	# prefer-dynamic does what it says
31	$(RUSTC) foo.rs --extern bar -C prefer-dynamic
32	mv $(call DYLIB,bar) $(TMPDIR)/bar.tmp
33	$(call FAIL,foo)
34	mv $(TMPDIR)/bar.tmp $(call DYLIB,bar)