Skip to content

Commit 29c2a45

Browse files
authored
Merge pull request #848 from ojeda/retpoline
rust: move `retpoline-external-thunk` back to the target spec file
2 parents 61104a0 + eadf7b8 commit 29c2a45

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

arch/x86/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ ifdef CONFIG_CC_IS_CLANG
2121
RETPOLINE_CFLAGS := -mretpoline-external-thunk
2222
RETPOLINE_VDSO_CFLAGS := -mretpoline
2323
endif
24-
RETPOLINE_RUSTFLAGS := -Ctarget-feature=+retpoline-external-thunk
2524

2625
ifdef CONFIG_RETHUNK
2726
RETHUNK_CFLAGS := -mfunction-return=thunk-extern
@@ -203,7 +202,6 @@ ifdef CONFIG_RETPOLINE
203202
ifndef CONFIG_CC_IS_CLANG
204203
KBUILD_CFLAGS += -fno-jump-tables
205204
endif
206-
KBUILD_RUSTFLAGS += $(RETPOLINE_RUSTFLAGS)
207205
endif
208206

209207
ifdef CONFIG_SLS

rust/Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,10 @@ else
266266
bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \
267267
-mskip-rax-setup -mgeneral-regs-only -msign-return-address=% \
268268
-mindirect-branch=thunk-extern -mindirect-branch-register \
269-
-mrecord-mcount -mabi=lp64 -mstack-protector-guard% -mtraceback=no \
270-
-mno-pointers-to-nested-functions -mno-string -mno-strict-align \
271-
-mstrict-align \
269+
-mfunction-return=thunk-extern -mrecord-mcount -mabi=lp64 \
270+
-mstack-protector-guard% -mtraceback=no \
271+
-mno-pointers-to-nested-functions -mno-string \
272+
-mno-strict-align -mstrict-align \
272273
-fconserve-stack -falign-jumps=% -falign-loops=% \
273274
-femit-struct-debug-baseonly -fno-ipa-cp-clone -fno-ipa-sra \
274275
-fno-partial-inlining -fplugin-arg-arm_ssp_per_task_plugin-% \

scripts/generate_rust_target.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,11 @@ fn main() {
204204
"data-layout",
205205
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128",
206206
);
207-
ts.push("features", "-3dnow,-3dnowa,-mmx,+soft-float");
207+
let mut features = "-3dnow,-3dnowa,-mmx,+soft-float".to_string();
208+
if cfg.has("RETPOLINE") {
209+
features += ",+retpoline-external-thunk";
210+
}
211+
ts.push("features", features);
208212
ts.push("llvm-target", "x86_64-linux-gnu");
209213
ts.push("target-pointer-width", "64");
210214
} else {

0 commit comments

Comments
 (0)