diff --git a/Makefile b/Makefile index f41ec8c8426ba2..082b1d5fe989cb 100644 --- a/Makefile +++ b/Makefile @@ -570,7 +570,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 diff --git a/scripts/generate_rust_target.rs b/scripts/generate_rust_target.rs index e36211e6161117..11a4ab1f502060 100644 --- a/scripts/generate_rust_target.rs +++ b/scripts/generate_rust_target.rs @@ -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); }