失败:从 vmlinux 加载 btf:CONFIG_DEBUG_INFO_BTF=y 上的参数 make 无效

失败:从 vmlinux 加载 btf:CONFIG_DEBUG_INFO_BTF=y 上的参数 make 无效

linux-5.14.2.tar.gz我刚刚编译时出现以下错误patch-5.14.2-rt21.patch

 on CONFIG_DEBUG_INFO_BTF=y:

      AS      arch/x86/lib/iomap_copy_64.o
    arch/x86/lib/iomap_copy_64.S: Assembler messages:
    arch/x86/lib/iomap_copy_64.S:13: 警告:found `movsd'; assuming `movsl' was meant
      AR      arch/x86/lib/built-in.a
      GEN     .version
      CHK     include/generated/compile.h
      LD      vmlinux.o
    ld: warning: arch/x86/power/hibernate_asm_64.o: missing .note.GNU-stack section implies executable stack
    ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
      MODPOST vmlinux.symvers
      MODINFO modules.builtin.modinfo
      GEN     modules.builtin
      LD      .tmp_vmlinux.btf
    ld: warning: arch/x86/power/hibernate_asm_64.o: missing .note.GNU-stack section implies executable stack
    ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
    ld: warning: .tmp_vmlinux.btf has a LOAD segment with RWX permissions
      BTF     .btf.vmlinux.bin.o
      LD      .tmp_vmlinux.kallsyms1
    ld: warning: .btf.vmlinux.bin.o: missing .note.GNU-stack section implies executable stack
    ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
    ld: warning: .tmp_vmlinux.kallsyms1 has a LOAD segment with RWX permissions
      KSYMS   .tmp_vmlinux.kallsyms1.S
      AS      .tmp_vmlinux.kallsyms1.S
      LD      .tmp_vmlinux.kallsyms2
    ld: warning: .btf.vmlinux.bin.o: missing .note.GNU-stack section implies executable stack
    ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
    ld: warning: .tmp_vmlinux.kallsyms2 has a LOAD segment with RWX permissions
      KSYMS   .tmp_vmlinux.kallsyms2.S
      AS      .tmp_vmlinux.kallsyms2.S
      LD      vmlinux
    ld: warning: .btf.vmlinux.bin.o: missing .note.GNU-stack section implies executable stack
    ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
    ld: warning: vmlinux has a LOAD segment with RWX permissions
      BTFIDS  vmlinux

    failed: load btf from vmlinux: invalid argument make:
    make: *** [Makefile:1176: vmlinux] Error 255
    make: *** Deleting file 'vmlinux'

我知道如果CONFIG_DEBUG_INFO_BTF设置为n,编译不会报错,但我不想CONFIG_DEBUG_INFO_BTF设置为n

这个问题,看来是虚拟内存太小了,不过这个问题的始作俑者是使用了虚拟机,而我是物理机Debian12。我应该怎么办?

~/kernel/5.14.2/linux-5.14.2$ free -h
               total        used        free      shared  buff/cache   available
内存:         7.7Gi       508Mi       3.4Gi       1.2Mi       4.1Gi       7.2Gi
交换:         976Mi          0B       976Mi

答案1

这可能是因为您正在使用pahole1.24 或更高版本以及“较旧”的内核版本。看https://lore.kernel.org/bpf/Ywkq61Lhyf11SsSa@krava/T/#m008baf5c6d4f252dc74cefcd4105295cf08bfd52

简而言之,pahole您系统上的较新版本使用 生成了 BTF 信息BTF_KIND_ENUM64,但libbpf那些旧内核版本中使用的 不支持此 BTF 类型。

您可以尝试降级pahole到版本 1.23 或查找pahole构建中调用的位置并将--skip_encoding_btf_enum64标志传递给它。

对于将来遇到类似错误的任何人,请注意:pr_debug该工具的调用中会报告有用的信息resolve_btfids,如果您提高日志级别以便实际打印它们,将有助于确定问题所在。

如果您想通过从源代码构建来降级,则存储库位于此处:https://git.kernel.org/pub/scm/devel/pahole/pahole.git/

答案2

我通过更改内核版本解决了这个问题。

linux-6.4.tar.gz补丁-6.4.6-rt8.补丁

相关内容