Skip to content

Commit

Permalink
rust: Use 'pie' relocation mode under UML
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
sulix committed Sep 12, 2022
1 parent 2108da2 commit 3015c66
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,6 @@ KBUILD_RUSTFLAGS := $(rust_common_flags) \
-Cpanic=abort -Cembed-bitcode=n -Clto=n \
-Cforce-unwind-tables=n -Ccodegen-units=1 \
-Csymbol-mangling-version=v0 \
-Crelocation-model=static \
-Zfunction-sections=n \
-Dclippy::float_arithmetic

Expand Down
6 changes: 6 additions & 0 deletions scripts/generate_rust_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,5 +228,11 @@ fn main() {
ts.push("target-endian", "big");
}

if cfg.has("UML") {
ts.push("relocation_model", "pie");
} else {
ts.push("relocation_model", "static");
}

println!("{}", ts);
}

0 comments on commit 3015c66

Please sign in to comment.