rewrite relocation-model to rmake · rust-lang/rust@75ee1d7 (original) (raw)
File tree
3 files changed
lines changed
- tests/run-make/relocation-model
3 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -164,7 +164,6 @@ run-make/raw-dylib-inline-cross-dylib/Makefile | ||
164 | 164 | run-make/raw-dylib-link-ordinal/Makefile |
165 | 165 | run-make/raw-dylib-stdcall-ordinal/Makefile |
166 | 166 | run-make/redundant-libs/Makefile |
167 | -run-make/relocation-model/Makefile | |
168 | 167 | run-make/relro-levels/Makefile |
169 | 168 | run-make/remap-path-prefix-dwarf/Makefile |
170 | 169 | run-make/remap-path-prefix/Makefile |
Original file line number | Diff line number | Diff 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 | +} |