Skip to content

Commit 3aa68a3

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 2108da2 commit 3aa68a3

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,6 @@ KBUILD_RUSTFLAGS := $(rust_common_flags) \
567567
-Cpanic=abort -Cembed-bitcode=n -Clto=n \
568568
-Cforce-unwind-tables=n -Ccodegen-units=1 \
569569
-Csymbol-mangling-version=v0 \
570-
-Crelocation-model=static \
571570
-Zfunction-sections=n \
572571
-Dclippy::float_arithmetic
573572

scripts/generate_rust_target.rs

Lines changed: 6 additions & 0 deletions
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)