foss-for-synopsys-dwc-arc-processors/linux

ARCv3: BTF generation failure: invalid unit tag type

geomatsi opened this issue · 0 comments

Kernel build fails for HS6x (ARCv3 64-bit) configuration with enabled CONFIG_DEBUG_INFO_BTF even if workaround from #87 is applied:

$ ARCH=arc CROSS_COMPILE=arc64-buildroot-linux-gnu- make 
  ...
  CC      init/version.o
  AR      init/built-in.a
  LD      vmlinux.o
  MODPOST vmlinux.symvers
  MODINFO modules.builtin.modinfo
  GEN     modules.builtin
  LD      .tmp_vmlinux.btf
  BTF     .btf.vmlinux.bin.o
die__process: DW_TAG_compile_unit, DW_TAG_type_unit, DW_TAG_partial_unit or DW_TAG_skeleton_unit expected got INVALID (0x0)!
pahole: .tmp_vmlinux.btf: Invalid argument
  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: No such file or directory
make: *** [Makefile:1161: vmlinux] Error 255
make: *** Deleting file 'vmlinux'

Quick hack for pahole to workaround the issue and to generate [possibly invalid] BTF in order to try out BPF on HS6x:

diff --git a/dwarf_loader.c b/dwarf_loader.c
index a0d964b..a1f40bf 100644
--- a/dwarf_loader.c
+++ b/dwarf_loader.c
@@ -2552,7 +2552,7 @@ static int die__process(Dwarf_Die *die, struct cu *cu, struct conf_load *conf)
        if (tag != DW_TAG_compile_unit && tag != DW_TAG_type_unit) {
                fprintf(stderr, "%s: DW_TAG_compile_unit, DW_TAG_type_unit, DW_TAG_partial_unit or DW_TAG_skeleton_unit expected got %s (0x%x)!\n",
                        __FUNCTION__, dwarf_tag_name(tag), tag);
-               return -EINVAL;
+               return 0;
        }

        cu->language = attr_numeric(die, DW_AT_language);

Root cause: TBD