Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
BTF bugreport
# Download and build pahole
$ cd pahole/
$ git log | head -n1
commit 8d6f06f053a06829589dd3b4b4f88f8a73a21006
# Fetch kernel dwarf v5 patches
$ cd linux-next
$ git log | head -n1
commit eb2b7c3470d2502126b592863ee4a3630b85b373
$ b4 am https://lore.kernel.org/lkml/20210130004401.2528717-1-ndesaulniers@google.com/ -o - | git am
# Remove !BTF kconfig
$ cat patch.txt
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index ad6f78989d4f..28b54d81edb8 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -272,7 +272,6 @@ config DEBUG_INFO_DWARF5
bool "Generate DWARF Version 5 debuginfo"
depends on GCC_VERSION >= 50000 || CC_IS_CLANG
depends on CC_IS_GCC || $(success,$(srctree)/scripts/test_dwarf5_support.sh $(CC) $(CLANG_FLAGS))
- depends on !DEBUG_INFO_BTF
help
Generate DWARF v5 debug info. Requires binutils 2.35.2, gcc 5.0+ (gcc
5.0+ accepts the -gdwarf-5 flag but only had partial support for some
# Configure linux kernel
$ make LLVM=1 LLVM_IAS=1 -j72 defconfig
$ ./scripts/config -e DEBUG_INFO_BTF -e DEBUG_INFO -e DEBUG_INFO_DWARF5
$ make LLVM=1 LLVM_IAS=1 -j72 olddefconfig
$ grep DEBUG_INFO .config
CONFIG_DEBUG_INFO=y
# CONFIG_DEBUG_INFO_REDUCED is not set
# CONFIG_DEBUG_INFO_COMPRESSED is not set
# CONFIG_DEBUG_INFO_SPLIT is not set
# CONFIG_DEBUG_INFO_DWARF4 is not set
CONFIG_DEBUG_INFO_DWARF5=y
CONFIG_DEBUG_INFO_BTF=y
# Build
$ PATH=/path/to/pahole/build:$PATH make LLVM=1 LLVM_IAS=1 -j72
...
GEN modules.builtin
LD .tmp_vmlinux.btf
BTF .btf.vmlinux.bin.o
[12919] INT DW_ATE_unsigned_1 Error emitting BTF type
Encountered error while encoding BTF.
LD .tmp_vmlinux.kallsyms1
KSYMS .tmp_vmlinux.kallsyms1.S
AS .tmp_vmlinux.kallsyms1.S
LD .tmp_vmlinux.kallsyms2
KSYMS .tmp_vmlinux.kallsyms2.S
AS .tmp_vmlinux.kallsyms2.S
LD vmlinux
BTFIDS vmlinux
FAILED: load BTF from vmlinux: Invalid argument
make: *** [Makefile:1178: vmlinux] Error 255
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment