Skip to content

Commit ccb389f

Browse files
committed
rust: Use 'pie' relocation mode under UML
UML expects a position independent executable for some reason, so tell rustc to generate pie objects. Otherwise we get a bunch of relocations we can't deal with in libcore. Signed-off-by: David Gow <[email protected]>
1 parent f112128 commit ccb389f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Makefile

-1
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,6 @@ KBUILD_RUSTFLAGS := $(rust_common_flags) \
570570
-Cpanic=abort -Cembed-bitcode=n -Clto=n \
571571
-Cforce-unwind-tables=n -Ccodegen-units=1 \
572572
-Csymbol-mangling-version=v0 \
573-
-Crelocation-model=static \
574573
-Zfunction-sections=n \
575574
-Dclippy::float_arithmetic
576575

scripts/generate_rust_target.rs

+6
Original file line numberDiff line numberDiff line change
@@ -228,5 +228,11 @@ fn main() {
228228
ts.push("target-endian", "big");
229229
}
230230

231+
if cfg.has("UML") {
232+
ts.push("relocation-model", "pie");
233+
} else {
234+
ts.push("relocation-model", "static");
235+
}
236+
231237
println!("{}", ts);
232238
}

0 commit comments

Comments
 (0)