rewrite relocation-model to rmake

This commit is contained in:
Oneirical 2024-06-19 16:18:33 -04:00
parent 5c8459f1ec
commit 75ee1d74a9
3 changed files with 26 additions and 21 deletions

View File

@ -164,7 +164,6 @@ run-make/raw-dylib-inline-cross-dylib/Makefile
run-make/raw-dylib-link-ordinal/Makefile
run-make/raw-dylib-stdcall-ordinal/Makefile
run-make/redundant-libs/Makefile
run-make/relocation-model/Makefile
run-make/relro-levels/Makefile
run-make/remap-path-prefix-dwarf/Makefile
run-make/remap-path-prefix/Makefile

View File

@ -1,20 +0,0 @@
# ignore-cross-compile
include ../tools.mk
all: others
$(RUSTC) -C relocation-model=dynamic-no-pic foo.rs
$(call RUN,foo)
$(RUSTC) -C relocation-model=default foo.rs
$(call RUN,foo)
$(RUSTC) -C relocation-model=dynamic-no-pic --crate-type=dylib foo.rs --emit=link,obj
ifdef IS_MSVC
# FIXME(#28026)
others:
else
others:
$(RUSTC) -C relocation-model=static foo.rs
$(call RUN,foo)
endif

View File

@ -0,0 +1,26 @@
// 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() {
// FIXME(Oneirical): This first one will likely fail on MSVC due to #28026.
// Remove this after try-job
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();
}