Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Nov 2021 14:48:03 -0500
From:      Mark Johnston <markj@freebsd.org>
To:        Andriy Gapon <avg@freebsd.org>
Cc:        FreeBSD Current <current@freebsd.org>
Subject:   Re: ctfconvert: rc = 1 Unsupported version [_dwarf_info_load(229)]
Message-ID:  <YaE584vhhhepxuUW@nuc>
In-Reply-To: <YaEuyyr5mQoroMiE@nuc>
References:  <cba74929-19d6-3d29-6288-feeef3127577@FreeBSD.org> <YaEF8VJWht%2BFcI1t@nuc> <e5cbcdd8-ea9e-fe60-4c0b-7b02882d6689@FreeBSD.org> <YaEuyyr5mQoroMiE@nuc>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Nov 26, 2021 at 02:00:27PM -0500, Mark Johnston wrote:
> On Fri, Nov 26, 2021 at 06:12:49PM +0200, Andriy Gapon wrote:
> > On 26/11/2021 18:06, Mark Johnston wrote:
> > > On Thu, Nov 25, 2021 at 10:48:36PM +0200, Andriy Gapon wrote:
> > >>
> > >> I've just finished builds of yesterday's CURRENT / main for arm and arm64.
> > >> In both builds I got lots of messages from ctfconvert:
> > >>     ctfconvert: rc = 1 Unsupported version [_dwarf_info_load(229)]
> > >>
> > >> I got an impression that there was a message for each object file, that's how
> > >> many of them were there.
> > >>
> > >> I don't recall seeing those messages before.
> > >>
> > >> Should I be concerned?
> > >> Maybe I am doing something wrong or have an unusual configuration?
> > >> Any way to fix the issue?
> > >>
> > >> Thanks!
> > >>
> > >> P.S.
> > >> The builds were done on stable/13, so maybe there is an issue with host tools
> > >> not being able to grok something new.
> > > 
> > > I haven't seen this before, for what it's worth.  I presume this is from
> > > a kernel build?  Does the configuration enable generation of debug info
> > > with, e.g., "makeoptions DEBUG=-g"?
> > 
> > This is actually from buildworld.
> > buildkernel is silent.
> 
> Thanks, I can reproduce it now.
> 
> Our libdwarf is complaining that the first compilation unit header in
> .debug_info contains an unsupported DWARF version number (libdwarf only
> supports 2, 3 and 4).  In files compiled by clang it ends up being zero.
> For instance, compiling bin/cat and dumping the .debug_info section:
> 
> gcc10:
>  c1250000 04000000 00000801 00000000
>            ^ DWARF version
> clang:
>   01000000 00000000 4e230000 00000000
> 
> llvm-dwarfdump and binutils readelf are somehow still able to find a
> valid-looking unit header, but I haven't yet been able to figure out how
> they do that from reading the DWARF 4/5 specs or the LLVM sources.

Ah, we recently started configuring clang to compress debug sections by
default, and our libdwarf doesn't know how to handle that.  As an
interim workaround this could simply be disabled with WITH_CTF is
configured:

diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
index 10262e6bb80c..5a5be3494471 100644
--- a/share/mk/bsd.lib.mk
+++ b/share/mk/bsd.lib.mk
@@ -113,7 +113,7 @@ CXXFLAGS+= -ftrivial-auto-var-init=pattern
 
 .if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \
     empty(DEBUG_FLAGS:M-gdwarf*)
-.if !${COMPILER_FEATURES:Mcompressed-debug}
+.if !${COMPILER_FEATURES:Mcompressed-debug} || ${MK_CTF} == "yes"
 CFLAGS+= ${DEBUG_FILES_CFLAGS:N-gz*}
 CXXFLAGS+= ${DEBUG_FILES_CFLAGS:N-gz*}
 .else
diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk
index 437ccf373130..21597128f991 100644
--- a/share/mk/bsd.prog.mk
+++ b/share/mk/bsd.prog.mk
@@ -93,7 +93,7 @@ CFLAGS+=${CRUNCH_CFLAGS}
 .else
 .if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \
     empty(DEBUG_FLAGS:M-gdwarf-*)
-.if !${COMPILER_FEATURES:Mcompressed-debug}
+.if !${COMPILER_FEATURES:Mcompressed-debug} || ${MK_CTF} == "yes"
 CFLAGS+= ${DEBUG_FILES_CFLAGS:N-gz*}
 .else
 CFLAGS+= ${DEBUG_FILES_CFLAGS}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YaE584vhhhepxuUW>