Skip to content

Commit dcc5038

Browse files
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. 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: Rust-for-Linux/linux#735 [3] Co-developed-by: Eric Curtin <[email protected]> Signed-off-by: Eric Curtin <[email protected]> Signed-off-by: Martin Rodriguez Reboredo <[email protected]>
1 parent 84b0fc2 commit dcc5038

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
@@ -1913,7 +1913,7 @@ config RUST
19131913
depends on !MODVERSIONS
19141914
depends on !GCC_PLUGINS
19151915
depends on !RANDSTRUCT
1916-
depends on !DEBUG_INFO_BTF
1916+
depends on !DEBUG_INFO_BTF || PAHOLE_HAS_LANG_EXCLUDE
19171917
select CONSTRUCTORS
19181918
help
19191919
Enables Rust support in the kernel.

lib/Kconfig.debug

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

367+
config PAHOLE_HAS_LANG_EXCLUDE
368+
def_bool PAHOLE_VERSION >= 124
369+
help
370+
Support for the --lang_exclude flag which makes pahole exclude
371+
compilation units from the supplied language. Used in Kbuild to
372+
omit Rust CUs which are not supported in version 1.24 of pahole,
373+
otherwise it would emit malformed kernel and module binaries when
374+
using DEBUG_INFO_BTF_MODULES.
375+
367376
config DEBUG_INFO_BTF_MODULES
368377
def_bool y
369378
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)