Skip to content

Commit 211d8ae

Browse files
committed
rust: prevent bindgen from generating #[derive(Debug)]
Bindgen generates `#[derive(Debug)]` for all bindings by default. We never use these, and probably it didn't make sense to use them at all. But as we currently do not have LTO enabled, and all the bindings are exported via `pub mod bindings`, these `Debug` implementations take a lot of space. On my config this saves 400 KB of space: text data bss dec hex filename 6388276 2284324 292872 8965472 88cd60 vmlinux (with `Debug`) 6079475 2200836 292872 8573183 82d0ff vmlinux (without `Debug`) Signed-off-by: Gary Guo <[email protected]>
1 parent 7fde08b commit 211d8ae

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

rust/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ quiet_cmd_bindgen = BINDGEN $@
9191
cmd_bindgen = \
9292
$(BINDGEN) $< $(shell grep -v '^\#\|^$$' $(srctree)/rust/bindgen_parameters) \
9393
--use-core --with-derive-default --ctypes-prefix c_types \
94+
--no-debug '.*' \
9495
--size_t-is-usize -o $@ -- $(bindgen_c_flags_final) -DMODULE
9596

9697
$(objtree)/rust/bindings_generated.rs: $(srctree)/rust/kernel/bindings_helper.h \

0 commit comments

Comments
 (0)