2023-03-30 08:46:31 -05:00
|
|
|
# ignore-cross-compile
|
2022-08-22 19:00:00 -05:00
|
|
|
include ../tools.mk
|
2019-09-29 20:17:27 -05:00
|
|
|
|
|
|
|
# Test mixing pathless --extern with paths.
|
|
|
|
|
2023-07-14 09:50:21 -05: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-29 20:17:27 -05:00
|
|
|
all:
|
2023-07-14 09:50:21 -05:00
|
|
|
$(RUSTC) bar.rs --crate-type=rlib --crate-type=dylib -Cprefer-dynamic
|
|
|
|
|
2019-09-29 20:17:27 -05:00
|
|
|
# rlib preferred over dylib
|
|
|
|
$(RUSTC) foo.rs --extern bar
|
2023-07-14 09:50:21 -05:00
|
|
|
mv $(call DYLIB,bar) $(TMPDIR)/bar.tmp
|
|
|
|
$(call RUN,foo)
|
|
|
|
mv $(TMPDIR)/bar.tmp $(call DYLIB,bar)
|
|
|
|
|
2019-09-29 20:17:27 -05:00
|
|
|
$(RUSTC) foo.rs --extern bar=$(TMPDIR)/libbar.rlib --extern bar
|
2023-07-14 09:50:21 -05:00
|
|
|
mv $(call DYLIB,bar) $(TMPDIR)/bar.tmp
|
|
|
|
$(call RUN,foo)
|
|
|
|
mv $(TMPDIR)/bar.tmp $(call DYLIB,bar)
|
|
|
|
|
2019-09-29 20:17:27 -05:00
|
|
|
# explicit --extern overrides pathless
|
|
|
|
$(RUSTC) foo.rs --extern bar=$(call DYLIB,bar) --extern bar
|
2023-07-14 09:50:21 -05:00
|
|
|
mv $(call DYLIB,bar) $(TMPDIR)/bar.tmp
|
|
|
|
$(call FAIL,foo)
|
|
|
|
mv $(TMPDIR)/bar.tmp $(call DYLIB,bar)
|
|
|
|
|
2019-09-29 20:17:27 -05:00
|
|
|
# prefer-dynamic does what it says
|
|
|
|
$(RUSTC) foo.rs --extern bar -C prefer-dynamic
|
2023-07-14 09:50:21 -05:00
|
|
|
mv $(call DYLIB,bar) $(TMPDIR)/bar.tmp
|
|
|
|
$(call FAIL,foo)
|
|
|
|
mv $(TMPDIR)/bar.tmp $(call DYLIB,bar)
|