rewrite relocation-model to rmake · rust-lang/rust@75ee1d7

File tree

3 files changed

lines changed

  • tests/run-make/relocation-model

3 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -164,7 +164,6 @@ run-make/raw-dylib-inline-cross-dylib/Makefile

164164

run-make/raw-dylib-link-ordinal/Makefile

165165

run-make/raw-dylib-stdcall-ordinal/Makefile

166166

run-make/redundant-libs/Makefile

167-

run-make/relocation-model/Makefile

168167

run-make/relro-levels/Makefile

169168

run-make/remap-path-prefix-dwarf/Makefile

170169

run-make/remap-path-prefix/Makefile

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,26 @@

1+

// Generation of position-independent code (PIC) can be altered

2+

// through use of the -C relocation-model rustc flag. This test

3+

// uses varied values with this flag and checks that compilation

4+

// succeeds.

5+

// See https://github.com/rust-lang/rust/pull/13340

6+
7+

//@ ignore-cross-compile

8+
9+

use run_make_support::{run, rustc};

10+
11+

fn main() {

12+

// FIXME(Oneirical): This first one will likely fail on MSVC due to #28026.

13+

// Remove this after try-job

14+

rustc().arg("-Crelocation-model=static").input("foo.rs").run();

15+

run("foo");

16+

rustc().arg("-Crelocation-model=dynamic-no-pic").input("foo.rs").run();

17+

run("foo");

18+

rustc().arg("-Crelocation-model=default").input("foo.rs").run();

19+

run("foo");

20+

rustc()

21+

.arg("-Crelocation-model=dynamic-no-pic")

22+

.crate_type("dylib")

23+

.emit("link,obj")

24+

.input("foo.rs")

25+

.run();

26+

}