Skip to content

Commit 75167a0

Browse files
committed
rust: Filter out LTO options from bindgen
Whenever LTO is configured to be used during building, CC_FLAGS_LTO are filtered out from C flags passed to bindgen. Signed-off-by: Dariusz Sosnowski <[email protected]>
1 parent 67e981d commit 75167a0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

rust/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,14 @@ bindgen_c_flags = $(filter-out $(bindgen_skip_c_flags), $(c_flags)) \
217217
$(bindgen_extra_c_flags)
218218
endif
219219

220+
ifdef CONFIG_LTO
221+
bindgen_c_flags_lto = $(filter-out $(CC_FLAGS_LTO), $(bindgen_c_flags))
222+
else
223+
bindgen_c_flags_lto = $(bindgen_c_flags)
224+
endif
225+
220226
# To avoid several recompilations in PowerPC, which inserts `-D_TASK_CPU`
221-
bindgen_c_flags_final = $(filter-out -D_TASK_CPU=%, $(bindgen_c_flags))
227+
bindgen_c_flags_final = $(filter-out -D_TASK_CPU=%, $(bindgen_c_flags_lto))
222228

223229
quiet_cmd_bindgen = BINDGEN $@
224230
cmd_bindgen = \

0 commit comments

Comments
 (0)