summary refs log tree commit diff
path: root/tests/run-make/fat-then-thin-lto/rmake.rs
blob: ef4f26689d4e8f58a55da20f7d3ba9c75c1b9120 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Compile a library with lto=fat, then compile a binary with lto=thin
// and check that lto is applied with the library.
// The goal is to mimic the standard library being build with lto=fat
// and allowing users to build with lto=thin.

//@ only-x86_64-unknown-linux-gnu

use run_make_support::{dynamic_lib_name, llvm_objdump, rustc};

fn main() {
    rustc().input("lib.rs").opt_level("3").lto("fat").run();
    rustc().input("main.rs").panic("abort").opt_level("3").lto("thin").run();

    llvm_objdump()
        .input(dynamic_lib_name("main"))
        .arg("--disassemble-symbols=bar")
        .run()
        // The called function should be inlined.
        // Check that we have a ret (to detect tail
        // calls with a jmp) and no call.
        .assert_stdout_contains("bar")
        .assert_stdout_contains("ret")
        .assert_stdout_not_contains("foo")
        .assert_stdout_not_contains("call");
}