1 include ../../run-make-fulldeps/tools.mk
3 # Ensure that crates compiled with different rustc versions cannot
4 # be dynamically linked.
6 FLAGS := -Cprefer-dynamic -Zsymbol-mangling-version=v0
7 UNAME := $(shell uname)
12 ifeq ($(UNAME),Darwin)
23 $(RUSTC) a.rs --crate-type=dylib $(FLAGS)
24 # Write symbols to disk.
25 $(NM_CMD) $(call DYLIB,a) > $(TMPDIR)/symbolsbefore
27 $(RUSTC) b.rs --extern a=$(TMPDIR)/liba$(EXT) --crate-type=bin -Crpath $(FLAGS)
29 # Now re-compile a.rs with another rustc version
30 RUSTC_FORCE_RUSTC_VERSION=deadfeed $(RUSTC) a.rs --crate-type=dylib $(FLAGS)
31 # After compiling with a different rustc version, write symbols to disk again.
32 $(NM_CMD) $(call DYLIB,a) > $(TMPDIR)/symbolsafter
33 # As a sanity check, test if the symbols changed:
34 # If the symbols are identical, there's been an error.
35 if diff $(TMPDIR)/symbolsbefore $(TMPDIR)/symbolsafter; then exit 1; fi