2018-04-17 06:38:19 -05:00
|
|
|
|
|
|
|
# min-llvm-version 4.0
|
2018-04-23 04:48:51 -05:00
|
|
|
# ignore-mingw
|
2018-04-17 06:38:19 -05:00
|
|
|
|
|
|
|
-include ../../run-make-fulldeps/tools.mk
|
|
|
|
|
2018-04-16 09:26:40 -05:00
|
|
|
# This test makes sure that the expected .llvmbc sections for use by
|
|
|
|
# linker-based LTO are available in object files when compiling with
|
|
|
|
# -Z cross-lang-lto
|
|
|
|
|
|
|
|
LLVMBC_SECTION_NAME=\\.llvmbc
|
|
|
|
|
|
|
|
ifeq ($(UNAME),Darwin)
|
2018-05-07 02:52:38 -05:00
|
|
|
LLVMBC_SECTION_NAME=__bitcode
|
2018-04-16 09:26:40 -05:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
2018-04-17 04:43:33 -05:00
|
|
|
OBJDUMP=llvm-objdump
|
2018-04-16 09:26:40 -05:00
|
|
|
SECTION_HEADERS=$(OBJDUMP) -section-headers
|
|
|
|
|
2018-04-25 08:45:04 -05:00
|
|
|
BUILD_LIB=$(RUSTC) lib.rs -Copt-level=2 -Z cross-lang-lto=no-link -Ccodegen-units=1
|
2018-04-16 09:26:40 -05:00
|
|
|
|
2018-04-25 08:45:04 -05:00
|
|
|
BUILD_EXE=$(RUSTC) main.rs -Copt-level=2 -Z cross-lang-lto=no-link -Ccodegen-units=1 --emit=obj
|
2018-04-16 09:26:40 -05:00
|
|
|
|
|
|
|
all: staticlib staticlib-fat-lto staticlib-thin-lto rlib exe cdylib rdylib
|
|
|
|
|
|
|
|
staticlib: lib.rs
|
2018-04-23 04:48:51 -05:00
|
|
|
$(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib.a
|
2018-04-16 09:26:40 -05:00
|
|
|
[ "$$($(SECTION_HEADERS) $(TMPDIR)/liblib.a | grep -c $(LLVMBC_SECTION_NAME))" -ne "0" ]
|
|
|
|
|
|
|
|
staticlib-fat-lto: lib.rs
|
|
|
|
$(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib-fat-lto.a -Clto=fat
|
|
|
|
[ "$$($(SECTION_HEADERS) $(TMPDIR)/liblib-fat-lto.a | grep -c $(LLVMBC_SECTION_NAME))" -ne "0" ]
|
|
|
|
|
|
|
|
staticlib-thin-lto: lib.rs
|
|
|
|
$(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib-thin-lto.a -Clto=thin
|
|
|
|
[ "$$($(SECTION_HEADERS) $(TMPDIR)/liblib-thin-lto.a | grep -c $(LLVMBC_SECTION_NAME))" -ne "0" ]
|
|
|
|
|
|
|
|
rlib: lib.rs
|
2018-04-23 04:48:51 -05:00
|
|
|
$(BUILD_LIB) --crate-type=rlib -o $(TMPDIR)/liblib.rlib
|
2018-04-16 09:26:40 -05:00
|
|
|
[ "$$($(SECTION_HEADERS) $(TMPDIR)/liblib.rlib | grep -c $(LLVMBC_SECTION_NAME))" -ne "0" ]
|
|
|
|
|
|
|
|
cdylib: lib.rs
|
|
|
|
$(BUILD_LIB) --crate-type=cdylib --emit=obj -o $(TMPDIR)/cdylib.o
|
|
|
|
[ "$$($(SECTION_HEADERS) $(TMPDIR)/cdylib.o | grep -c $(LLVMBC_SECTION_NAME))" -ne "0" ]
|
|
|
|
|
|
|
|
rdylib: lib.rs
|
|
|
|
$(BUILD_LIB) --crate-type=dylib --emit=obj -o $(TMPDIR)/rdylib.o
|
|
|
|
[ "$$($(SECTION_HEADERS) $(TMPDIR)/rdylib.o | grep -c $(LLVMBC_SECTION_NAME))" -ne "0" ]
|
|
|
|
|
|
|
|
exe: lib.rs
|
|
|
|
$(BUILD_EXE) -o $(TMPDIR)/exe.o
|
|
|
|
[ "$$($(SECTION_HEADERS) $(TMPDIR)/exe.o | grep -c $(LLVMBC_SECTION_NAME))" -ne "0" ]
|