public inbox for dwarves@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: "Martin Liška" <mliska@suse.cz>, "Yonghong Song" <yhs@fb.com>,
	"Andrii Nakryiko" <andrii.nakryiko@gmail.com>
Cc: dwarves@vger.kernel.org, Nick Clifton <nickc@redhat.com>
Subject: Re: Encountered error while encoding BTF due to Unsupported DW_TAG_unspecified_type(0x3b)
Date: Tue, 4 Oct 2022 09:31:15 -0300	[thread overview]
Message-ID: <Yzwnk/a1ROHrtA2/@kernel.org> (raw)
In-Reply-To: <YzwkazNc6wNCpQTN@kernel.org>

Em Tue, Oct 04, 2022 at 09:17:47AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Mon, Oct 03, 2022 at 10:56:36AM +0200, Martin Liška escreveu:
> > I noticed one can't build 5.19 with latest binutils master.
> > 
> > One see the following error:
> > [ 1413s]   BTF     .btf.vmlinux.bin.o
> > [ 1413s] Unsupported DW_TAG_unspecified_type(0x3b)
> > [ 1413s] Encountered error while encoding BTF.
> > 
> > It's caused by DWARF coming from .S files and the change is introduced since
> > the following binutils revision:
> > 
> > commit 5578fbf672ee497ea19826edeb509f4cc3e825a8
> > Author: Nick Clifton <nickc@redhat.com>
> > Date:   Thu Aug 25 11:48:00 2022 +0100
> > 
> >     GAS: Add a return type tag to DWARF DIEs generated for function symbols.
> > 
> > for entry.S the output changes to:
> > 
> > $ as-new --gdwarf-5 --64 -o entry.o entry.S && readelf -wi entry.o
> > Contents of the .debug_info section:
> > 
> >   Compilation Unit @ offset 0x0:
> >    Length:        0x35 (32-bit)
> >    Version:       5
> >    Unit Type:     DW_UT_compile (1)
> >    Abbrev Offset: 0x0
> >    Pointer Size:  8
> >  <0><c>: Abbrev Number: 3 (DW_TAG_unspecified_type) <--- the problematic TAG
> >  <0><d>: Abbrev Number: 1 (DW_TAG_compile_unit)
> >     <e>   DW_AT_stmt_list   : 0x0
> >     <12>   DW_AT_low_pc      : 0x0
> >     <1a>   DW_AT_high_pc     : 19
> >     <1b>   DW_AT_name        : (indirect string, offset: 0x0): ../arch/x86/entry/entry.S
> >     <1f>   DW_AT_comp_dir    : (indirect string, offset: 0x1a): /tmp
> >     <23>   DW_AT_producer    : (indirect string, offset: 0x1f): GNU AS 2.39.50
> >     <27>   DW_AT_language    : 32769	(MIPS assembler)
> >  <1><29>: Abbrev Number: 2 (DW_TAG_subprogram)
> >     <2a>   DW_AT_name        : (indirect string, offset: 0x2e): entry_ibpb
> >     <2e>   DW_AT_external    : 1
> >     <2e>   DW_AT_type        : <0xc>
> 
> Ok, it happens at the top level of a CU and there are users for it, now
> to try to figure out how to best support this in the pretty printer,
> DWARF loader and BTF encoder.

And it is for an assembly routine, which clarifies things a bit more,
Andrii, Yonghong, should we try to encode BTF for assembly? Or just
skip it?

Martin, can you try a facility that was put in place to skip Rust kernel
modules, for some other DWARF generation problem?

oops, I didn't antecipate, assembler, so please try with the patch below
and then add:

   --lang_exclude asm

I.e. this extra patch, for the kernel:

diff --git a/scripts/pahole-flags.sh b/scripts/pahole-flags.sh
index 0d99ef17e4a52876..b999c6f0979ac02c 100755
--- a/scripts/pahole-flags.sh
+++ b/scripts/pahole-flags.sh
@@ -20,4 +20,8 @@ if [ "${pahole_ver}" -ge "122" ]; then
 	extra_paholeopt="${extra_paholeopt} -j"
 fi
 
+if [ "${pahole_ver}" -ge "124" ]; then
+	extra_paholeopt="${extra_paholeopt} --lang_exclude asm"
+fi
+
 echo ${extra_paholeopt}


------------------------------------------------------------------------

diff --git a/dwarves.c b/dwarves.c
index 9589747f49f8f3a7..0405592ce0a540a5 100644
--- a/dwarves.c
+++ b/dwarves.c
@@ -2240,6 +2240,9 @@ int lang__str2int(const char *lang)
 	[DW_LANG_UPC]		 = "upc",
 	};
 
+	if (strcasecmp(lang, "asm") == 0)
+		return DW_LANG_Mips_Assembler;
+
 	// c89 is the first, bliss is the last, see /usr/include/dwarf.h
 	for (int id = DW_LANG_C89; id <= DW_LANG_BLISS; ++id)
 		if (languages[id] && strcasecmp(lang, languages[id]) == 0)

  reply	other threads:[~2022-10-04 12:31 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-03  8:56 Encountered error while encoding BTF due to Unsupported DW_TAG_unspecified_type(0x3b) Martin Liška
2022-10-03 12:07 ` Nick Clifton
2022-10-04 12:15   ` Arnaldo Carvalho de Melo
2022-10-04 12:17 ` Arnaldo Carvalho de Melo
2022-10-04 12:31   ` Arnaldo Carvalho de Melo [this message]
2022-10-04 21:42     ` Arnaldo Carvalho de Melo
2022-10-05  8:41     ` Martin Liška
2022-10-04 12:33   ` Nick Clifton
2022-10-04 13:25     ` Arnaldo Carvalho de Melo
2022-10-04 18:07       ` Arnaldo Carvalho de Melo
2022-10-04 21:13         ` Arnaldo Carvalho de Melo
2022-10-04 21:44 ` Arnaldo Carvalho de Melo
2022-10-05  7:23   ` Martin Liška
2022-10-05 14:37     ` Arnaldo Carvalho de Melo
2022-10-05 15:43       ` Arnaldo Carvalho de Melo
2022-10-06 11:54         ` Martin Liška
     [not found]           ` <Yz7bevBJAm0JiLfp@kernel.org>
2022-10-06 14:00             ` Arnaldo Carvalho de Melo
2022-10-06 14:15               ` [PATCH/RFC pahole] btf_encoder: Encode DW_TAG_unspecified_type as BTF_KIND_CONST was: " Arnaldo Carvalho de Melo
2022-10-06 16:04               ` Andrii Nakryiko
2022-10-06 17:23                 ` Arnaldo Carvalho de Melo
2022-10-07 20:21                   ` Arnaldo Carvalho de Melo
2022-10-08  0:25                     ` Yonghong Song
2022-10-10 12:06                       ` Arnaldo Carvalho de Melo
2022-10-10 20:08                         ` Arnaldo Carvalho de Melo
2022-10-10 20:19                           ` Arnaldo Carvalho de Melo
2022-10-11  5:57                             ` Yonghong Song
2022-10-11 13:45                               ` Arnaldo Carvalho de Melo
2022-10-11 15:33                                 ` Yonghong Song
2022-10-11 17:16                                   ` Arnaldo Carvalho de Melo
2023-01-30  9:23                                     ` Martin Liška
2023-01-30 14:20                                       ` pahole 1.25 plans was: " Arnaldo Carvalho de Melo
2023-03-12  0:03                                         ` Dominique Martinet
2022-10-05 16:55 ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yzwnk/a1ROHrtA2/@kernel.org \
    --to=acme@kernel.org \
    --cc=andrii.nakryiko@gmail.com \
    --cc=dwarves@vger.kernel.org \
    --cc=mliska@suse.cz \
    --cc=nickc@redhat.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox