Skip to content

Commit c117797

Browse files
YakoYakoYokuYokuborkmann
authored andcommitted
btf, scripts: Exclude Rust CUs with pahole
Version 1.24 of pahole has the capability to exclude compilation units (CUs) of specific languages [1] [2]. Rust, as of writing, is not currently supported by pahole and if it's used with a build that has BTF debugging enabled it results in malformed kernel and module binaries [3]. So it's better for pahole to exclude Rust CUs until support for it arrives. Co-developed-by: Eric Curtin <[email protected]> Signed-off-by: Eric Curtin <[email protected]> Signed-off-by: Martin Rodriguez Reboredo <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Tested-by: Eric Curtin <[email protected]> Reviewed-by: Neal Gompa <[email protected]> Acked-by: Miguel Ojeda <[email protected]> Acked-by: Arnaldo Carvalho de Melo <[email protected]> Link: https://git.kernel.org/pub/scm/devel/pahole/pahole.git/commit/?id=49358dfe2aaae4e90b072332c3e324019826783f [1] Link: https://git.kernel.org/pub/scm/devel/pahole/pahole.git/commit/?id=8ee363790b7437283c53090a85a9fec2f0b0fbc4 [2] Link: #735 [3] Link: https://lore.kernel.org/bpf/[email protected]
1 parent dfff86f commit c117797

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

init/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1935,7 +1935,7 @@ config RUST
19351935
depends on !MODVERSIONS
19361936
depends on !GCC_PLUGINS
19371937
depends on !RANDSTRUCT
1938-
depends on !DEBUG_INFO_BTF
1938+
depends on !DEBUG_INFO_BTF || PAHOLE_HAS_LANG_EXCLUDE
19391939
select CONSTRUCTORS
19401940
help
19411941
Enables Rust support in the kernel.

lib/Kconfig.debug

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,15 @@ config PAHOLE_HAS_BTF_TAG
389389
btf_decl_tag) or not. Currently only clang compiler implements
390390
these attributes, so make the config depend on CC_IS_CLANG.
391391

392+
config PAHOLE_HAS_LANG_EXCLUDE
393+
def_bool PAHOLE_VERSION >= 124
394+
help
395+
Support for the --lang_exclude flag which makes pahole exclude
396+
compilation units from the supplied language. Used in Kbuild to
397+
omit Rust CUs which are not supported in version 1.24 of pahole,
398+
otherwise it would emit malformed kernel and module binaries when
399+
using DEBUG_INFO_BTF_MODULES.
400+
392401
config DEBUG_INFO_BTF_MODULES
393402
def_bool y
394403
depends on DEBUG_INFO_BTF && MODULES && PAHOLE_HAS_SPLIT_BTF

scripts/pahole-flags.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,9 @@ fi
1919
if [ "${pahole_ver}" -ge "122" ]; then
2020
extra_paholeopt="${extra_paholeopt} -j"
2121
fi
22+
if [ "${pahole_ver}" -ge "124" ]; then
23+
# see PAHOLE_HAS_LANG_EXCLUDE
24+
extra_paholeopt="${extra_paholeopt} --lang_exclude=rust"
25+
fi
2226

2327
echo ${extra_paholeopt}

0 commit comments

Comments
 (0)