about summary refs log tree commit diff
path: root/tests/run-make/std-core-cycle/rmake.rs
blob: 162b783aeb985b945c46640f85ec5906285aaf85 (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
26
27
// In some cases, linking libraries with GNU used to fail due to how
// `std` and `core` possess a circular dependency with one another, and
// how the linker could not go back through its symbol processing to resolve
// the circular link. #49316 fixed this, and this test reproduces a minimal
// version of one such linking attempt which used to fail.
// See https://github.com/rust-lang/rust/issues/18807

//@ ignore-cross-compile

use run_make_support::{is_darwin, is_windows, rustc};

fn main() {
    rustc().input("bar.rs").run();

    let mut rustc_foo = rustc();
    rustc_foo.input("foo.rs");
    let mut rustc_foo_panic = rustc();
    rustc_foo_panic.input("foo.rs").panic("abort");

    if !is_darwin() && !is_windows() {
        rustc_foo.arg("-Clink-args=-Wl,--no-undefined");
        rustc_foo_panic.arg("-Clink-args=-Wl,--no-undefined");
    }

    rustc_foo.run();
    rustc_foo_panic.run();
}