2018-08-03 10:09:50 -05:00
|
|
|
-include ../tools.mk
|
|
|
|
|
2019-01-24 13:17:02 -06:00
|
|
|
# ignore windows due to libLLVM being present in PATH and the PATH and library path being the same
|
|
|
|
# (so fixing it is harder). See #57765 for context
|
|
|
|
ifndef IS_WINDOWS
|
|
|
|
|
2018-08-03 10:09:50 -05:00
|
|
|
# This test makes sure that we don't loose upstream object files when compiling
|
2019-02-01 08:15:43 -06:00
|
|
|
# staticlibs with -C linker-plugin-lto
|
2018-08-03 10:09:50 -05:00
|
|
|
|
|
|
|
all: staticlib.rs upstream.rs
|
2019-02-01 08:15:43 -06:00
|
|
|
$(RUSTC) upstream.rs -C linker-plugin-lto -Ccodegen-units=1
|
2018-08-03 10:09:50 -05:00
|
|
|
|
|
|
|
# Check No LTO
|
2019-02-01 08:15:43 -06:00
|
|
|
$(RUSTC) staticlib.rs -C linker-plugin-lto -Ccodegen-units=1 -L. -o $(TMPDIR)/staticlib.a
|
2019-04-29 07:40:07 -05:00
|
|
|
(cd $(TMPDIR); "$(LLVM_BIN_DIR)"/llvm-ar x ./staticlib.a)
|
2018-08-03 10:09:50 -05:00
|
|
|
# Make sure the upstream object file was included
|
2018-08-06 04:16:28 -05:00
|
|
|
ls $(TMPDIR)/upstream.*.rcgu.o
|
2018-08-03 10:09:50 -05:00
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
rm $(TMPDIR)/*
|
|
|
|
|
|
|
|
# Check ThinLTO
|
2019-02-01 08:15:43 -06:00
|
|
|
$(RUSTC) upstream.rs -C linker-plugin-lto -Ccodegen-units=1 -Clto=thin
|
|
|
|
$(RUSTC) staticlib.rs -C linker-plugin-lto -Ccodegen-units=1 -Clto=thin -L. -o $(TMPDIR)/staticlib.a
|
2019-04-29 07:40:07 -05:00
|
|
|
(cd $(TMPDIR); "$(LLVM_BIN_DIR)"/llvm-ar x ./staticlib.a)
|
2018-08-06 04:16:28 -05:00
|
|
|
ls $(TMPDIR)/upstream.*.rcgu.o
|
2019-01-24 13:17:02 -06:00
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
all:
|
|
|
|
|
|
|
|
endif
|