]> git.lizzy.rs Git - rust.git/blob - tests/run-make-fulldeps/cross-lang-lto-clang/Makefile
Auto merge of #107303 - compiler-errors:intern-canonical-var-values, r=lcnr
[rust.git] / tests / run-make-fulldeps / cross-lang-lto-clang / Makefile
1 # needs-matching-clang
2
3 # This test makes sure that cross-language inlining actually works by checking
4 # the generated machine code.
5
6 include ../tools.mk
7
8 all: cpp-executable rust-executable
9
10 cpp-executable:
11         $(RUSTC) -Clinker-plugin-lto=on -o $(TMPDIR)/librustlib-xlto.a -Copt-level=2 -Ccodegen-units=1 ./rustlib.rs
12         $(CLANG) -flto=thin -fuse-ld=lld -L $(TMPDIR) -lrustlib-xlto -o $(TMPDIR)/cmain ./cmain.c -O3
13         # Make sure we don't find a call instruction to the function we expect to
14         # always be inlined.
15         "$(LLVM_BIN_DIR)"/llvm-objdump -d $(TMPDIR)/cmain | $(CGREP) -v -e "call.*rust_always_inlined"
16         # As a sanity check, make sure we do find a call instruction to a
17         # non-inlined function
18         "$(LLVM_BIN_DIR)"/llvm-objdump -d $(TMPDIR)/cmain | $(CGREP) -e "call.*rust_never_inlined"
19
20 rust-executable:
21         $(CLANG) ./clib.c -flto=thin -c -o $(TMPDIR)/clib.o -O2
22         (cd $(TMPDIR); $(AR) crus ./libxyz.a ./clib.o)
23         $(RUSTC) -Clinker-plugin-lto=on -L$(TMPDIR) -Copt-level=2 -Clinker=$(CLANG) -Clink-arg=-fuse-ld=lld ./main.rs -o $(TMPDIR)/rsmain
24         "$(LLVM_BIN_DIR)"/llvm-objdump -d $(TMPDIR)/rsmain | $(CGREP) -e "call.*c_never_inlined"
25         "$(LLVM_BIN_DIR)"/llvm-objdump -d $(TMPDIR)/rsmain | $(CGREP) -v -e "call.*c_always_inlined"