rust: kbuild: Don't export __pfx symbols
PATCH 1/1 rust: kbuild: Don't export __pfx symbols
With CONFIG_PREFIX_SYMBOLS, objtool adds __pfx prefix symbols to claim the compiler emitted call padding bytes. When CONFIG_X86_KERNEL_IBT is not selected, the symbols are added to individual object files and for Rust objects, they end up being exported, resulting in warnings with CONFIG_GENDWARFKSYMS as the symbols have no debugging information:
warning: gendwarfksyms: symbol_print_versions: no information for symbol __pfx_rust_helper_put_task_struct
warning: gendwarfksyms: symbol_print_versions: no information for symbol __pfx_rust_helper_task_euid
warning: gendwarfksyms: symbol_print_versions: no information for symbol __pfx_rust_helper_readq_relaxed
...
Filter out the __pfx prefix from exported symbols similarly to the existing __cfi and __odr_asan prefixes.
--- rust/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
rust/Makefile +1 -1
@@ -332,7 +332,7 @@ $(obj)/bindings/bindings_helpers_generated.rs: private bindgen_target_extra = ; $(obj)/bindings/bindings_helpers_generated.rs: $(src)/helpers/helpers.c FORCE $(call if_changed_dep,bindgen) -rust_exports = $(NM) -p --defined-only $(1) | awk '$$2~/(T|R|D|B)/ && $$3!~/__cfi/ && $$3!~/__odr_asan/ { printf $(2),$$3 }' +rust_exports = $(NM) -p --defined-only $(1) | awk '$$2~/(T|R|D|B)/ && $$3!~/__(pfx|cfi|odr_asan)/ { printf $(2),$$3 }' quiet_cmd_exports = EXPORTS $@ cmd_exports = \
Signature · 1 line
2.49.0.rc1.451.g8f38331e32-goog
Quoted 12 lines · Sami Tolvanen
With
CONFIG_PREFIX_SYMBOLS, objtool adds__pfxprefix symbols to claim the compiler emitted call padding bytes. WhenCONFIG_X86_KERNEL_IBTis not selected, the symbols are added to individual object files and for Rust objects, they end up being exported, resulting in warnings withCONFIG_GENDWARFKSYMSas the symbols have no debugging information:warning: gendwarfksyms:
symbol_print_versions: no information for symbol__pfx_rust_helper_put_task_struct
warning: gendwarfksyms:symbol_print_versions: no information for symbol__pfx_rust_helper_task_euid
warning: gendwarfksyms:symbol_print_versions: no information for symbol__pfx_rust_helper_readq_relaxed
...
Quoted 4 lines
Filter out the
__pfxprefix from exported symbols similarly to the existing__cfiand__odr_asanprefixes.Signed-off-by Sami Tolvanen <[email protected]>
Miguel Ojeda
AppliedQuoted 13 lines · Sami Tolvanen
With
CONFIG_PREFIX_SYMBOLS, objtool adds__pfxprefix symbols to claim the compiler emitted call padding bytes. WhenCONFIG_X86_KERNEL_IBTis not selected, the symbols are added to individual object files and for Rust objects, they end up being exported, resulting in warnings withCONFIG_GENDWARFKSYMSas the symbols have no debugging information:warning: gendwarfksyms:
symbol_print_versions: no information for symbol__pfx_rust_helper_put_task_struct
warning: gendwarfksyms:symbol_print_versions: no information for symbol__pfx_rust_helper_task_euid
warning: gendwarfksyms:symbol_print_versions: no information for symbol__pfx_rust_helper_readq_relaxed
...
Quoted 4 lines
Filter out the
__pfxprefix from exported symbols similarly to the existing__cfiand__odr_asanprefixes.Signed-off-by Sami Tolvanen <[email protected]>
Applied to rust-fixes -- thanks everyone!
It also gets rid of a lot of modpost warnings too at link time.
modversions for CONFIG_MODVERSIONS")
Thanks!
Cheers,
Miguel