2023-03-30 13:46:31 +00:00
|
|
|
# ignore-cross-compile
|
2022-08-23 00:00:00 +00:00
|
|
|
include ../tools.mk
|
2019-09-30 01:17:27 +00:00
|
|
|
|
|
|
|
# Test mixing pathless --extern with paths.
|
|
|
|
|
2023-07-14 14:50:21 +00:00
|
|
|
# Test for static linking by checking that the binary runs if the dylib
|
|
|
|
# is removed and test for dynamic linking by checking that the binary
|
|
|
|
# fails to run if the dylib is removed.
|
|
|
|
|
2019-09-30 01:17:27 +00:00
|
|
|
all:
|
2023-07-14 14:50:21 +00:00
|
|
|
$(RUSTC) bar.rs --crate-type=rlib --crate-type=dylib -Cprefer-dynamic
|
|
|
|
|
2019-09-30 01:17:27 +00:00
|
|
|
# rlib preferred over dylib
|
|
|
|
$(RUSTC) foo.rs --extern bar
|
2023-07-14 14:50:21 +00:00
|
|
|
mv $(call DYLIB,bar) $(TMPDIR)/bar.tmp
|
|
|
|
$(call RUN,foo)
|
|
|
|
mv $(TMPDIR)/bar.tmp $(call DYLIB,bar)
|
|
|
|
|
2019-09-30 01:17:27 +00:00
|
|
|
$(RUSTC) foo.rs --extern bar=$(TMPDIR)/libbar.rlib --extern bar
|
2023-07-14 14:50:21 +00:00
|
|
|
mv $(call DYLIB,bar) $(TMPDIR)/bar.tmp
|
|
|
|
$(call RUN,foo)
|
|
|
|
mv $(TMPDIR)/bar.tmp $(call DYLIB,bar)
|
|
|
|
|
2019-09-30 01:17:27 +00:00
|
|
|
# explicit --extern overrides pathless
|
|
|
|
$(RUSTC) foo.rs --extern bar=$(call DYLIB,bar) --extern bar
|
2023-07-14 14:50:21 +00:00
|
|
|
mv $(call DYLIB,bar) $(TMPDIR)/bar.tmp
|
|
|
|
$(call FAIL,foo)
|
|
|
|
mv $(TMPDIR)/bar.tmp $(call DYLIB,bar)
|
|
|
|
|
2019-09-30 01:17:27 +00:00
|
|
|
# prefer-dynamic does what it says
|
|
|
|
$(RUSTC) foo.rs --extern bar -C prefer-dynamic
|
2023-07-14 14:50:21 +00:00
|
|
|
mv $(call DYLIB,bar) $(TMPDIR)/bar.tmp
|
|
|
|
$(call FAIL,foo)
|
|
|
|
mv $(TMPDIR)/bar.tmp $(call DYLIB,bar)
|