Skip to content

Commit 18f48e3

Browse files
committed
rust: Replace -fmin-function-alignment with -falign-functions for bindgen
Commit 5270316 ("kbuild: Use -fmin-function-alignment when available") introduces `-fmin-function-alignment` if supported to remove a workaround for gcc not respecting `-falign-functions` for cold functions. bindgen does not recognize `-fmin-function-alignment` but `-falign-functions` is sufficient as long as bindgen is LLVM backed. See c27cd08 ("Compiler attributes: GCC cold function alignment workarounds"). So replace `-fmin-function-alignment` with `-falign-functions` for bindgen's C flags. Fixes: 5270316 ("kbuild: Use -fmin-function-alignment when available") Signed-off-by: Janne Grunau <j@jannau.net>
1 parent 690c9b4 commit 18f48e3

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

rust/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,13 @@ else
264264
bindgen_c_flags_lto = $(bindgen_c_flags)
265265
endif
266266

267-
bindgen_c_flags_final = $(bindgen_c_flags_lto) -D__BINDGEN__
267+
# replace '-fmin-function-alignment' with '-falign-functions'. LLVM does not
268+
# ignore the latter in cold functions. See:
269+
# 5270316c9fec ("kbuild: Use -fmin-function-alignment when available")
270+
# c27cd083cfb9 ("Compiler attributes: GCC cold function alignment workarounds")
271+
bindgen_c_flags_align = $(subst -fmin-function-alignment=,-falign-functions=,$(bindgen_c_flags_lto))
272+
273+
bindgen_c_flags_final = $(bindgen_c_flags_align) -D__BINDGEN__
268274

269275
quiet_cmd_bindgen = BINDGEN $@
270276
cmd_bindgen = \

0 commit comments

Comments
 (0)