]> git.lizzy.rs Git - rust.git/blob - src/test/run-make-fulldeps/issue-64153/Makefile
Auto merge of #100935 - cuviper:upgrade-android-ci, r=Mark-Simulacrum
[rust.git] / src / test / run-make-fulldeps / issue-64153 / Makefile
1 include ../tools.mk
2
3 # `llvm-objdump`'s output looks different on windows than on other platforms.
4 # It should be enough to check on Unix platforms, so:
5 # ignore-windows
6
7 # Staticlibs don't include Rust object files from upstream crates if the same
8 # code was already pulled into the lib via LTO. However, the bug described in
9 # https://github.com/rust-lang/rust/issues/64153 lead to this exclusion not
10 # working properly if the upstream crate was compiled with an explicit filename
11 # (via `-o`).
12 #
13 # This test makes sure that functions defined in the upstream crates do not
14 # appear twice in the final staticlib when listing all the symbols from it.
15
16 all:
17         $(RUSTC) --crate-type rlib upstream.rs -o $(TMPDIR)/libupstream.rlib -Ccodegen-units=1
18         $(RUSTC) --crate-type staticlib downstream.rs -Clto -Ccodegen-units=1 -o $(TMPDIR)/libdownstream.a
19         # Dump all the symbols from the staticlib into `syms`
20         "$(LLVM_BIN_DIR)"/llvm-objdump -t $(TMPDIR)/libdownstream.a > $(TMPDIR)/syms
21         # Count the global instances of `issue64153_test_function`. There'll be 2
22         # if the `upstream` object file got erroneously included twice.
23         # The line we are testing for with the regex looks something like:
24         # 0000000000000000 g     F .text.issue64153_test_function       00000023 issue64153_test_function
25         grep -c -e "[[:space:]]g[[:space:]]*F[[:space:]].*issue64153_test_function" $(TMPDIR)/syms > $(TMPDIR)/count
26         [ "$$(cat $(TMPDIR)/count)" -eq "1" ]