fork/rust

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

borsAuto merge of #68568 - pietroalbini:stable-next, r=pietroalbini5e1a799842b

1.41.0
839 B27 linesraw
1-include ../tools.mk
2
3ifdef IS_WINDOWS
4all:
5else
6
7# rustc will remove one of the two redundant references to foo below.  Depending
8# on which one gets removed, we'll get a linker error on SOME platforms (like
9# Linux).  On these platforms, when a library is referenced, the linker will
10# only pull in the symbols needed _at that point in time_.  If a later library
11# depends on additional symbols from the library, they will not have been pulled
12# in, and you'll get undefined symbols errors.
13#
14# So in this example, we need to ensure that rustc keeps the _later_ reference
15# to foo, and not the former one.
16RUSTC_FLAGS = \
17    -l static=bar \
18    -l foo \
19    -l static=baz \
20    -l foo \
21    -Z print-link-args
22
23all: $(call DYLIB,foo) $(call STATICLIB,bar) $(call STATICLIB,baz)
24	$(RUSTC) $(RUSTC_FLAGS) main.rs
25	$(call RUN,main)
26
27endif