about summary refs log tree commit diff
path: root/tests/run-make/relocation-model/rmake.rs
blob: 9cf85d6d730233879b38b0362bd5f6de3bb23e24 (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
// Generation of position-independent code (PIC) can be altered
// through use of the -C relocation-model rustc flag. This test
// uses varied values with this flag and checks that compilation
// succeeds.
// See https://github.com/rust-lang/rust/pull/13340

//@ ignore-cross-compile

use run_make_support::{run, rustc};

fn main() {
    rustc().arg("-Crelocation-model=static").input("foo.rs").run();
    run("foo");
    rustc().arg("-Crelocation-model=dynamic-no-pic").input("foo.rs").run();
    run("foo");
    rustc().arg("-Crelocation-model=default").input("foo.rs").run();
    run("foo");
    rustc()
        .arg("-Crelocation-model=dynamic-no-pic")
        .crate_type("dylib")
        .emit("link,obj")
        .input("foo.rs")
        .run();
}