Bug 215395 - ctfconvert from -r310152: gcc 6.2.0 based amd64-gcc or powerpc64-gcc output sometimes gets new dwarf error/abort from ctfconvert: die <SOME NUMBER>: failed to get ref
Summary: ctfconvert from -r310152: gcc 6.2.0 based amd64-gcc or powerpc64-gcc output s...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Mark Johnston
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-18 22:28 UTC by Mark Millard
Modified: 2017-02-03 01:33 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Millard 2016-12-18 22:28:26 UTC
[My archive of typescripts for buildkernel and the like goes back into
2016-July currently.]

Prior to the switch to powerpc64-gcc that is based on 6.2.0 none of my
buildkernel logs have messages like:

ERROR: ctfconvert: die <SOME NUMBER>: failed to get ref: No entry found [dwarf_attrval_unsigned(177)]

As far as I can tell from my history this is new, not historical.

I'm guessing ctfconvert and its libdwarf have more to do now instead of
devel/powerpc64-gcc being wrong. In part this is because of the following
side note.

[Bugzilla 215350 is about another new ctfconvert issue as of 6.2.0
powerpc64-gcc output --but that leads to SIGSEGV in ctfconvert. Once
the SIGSEGV is fixed what lead to the failing code path's use might
fit in this this report, although the message might be different.]

But I could be wrong.

I do not know just how bad of a thing it is for some files to have ctfconvert
call its terminate instead of finishing normally.




Note there are historically lots of messages with text including one of:

rc = -1 No entry found [dwarf_next_cu_header_c(61)]

rc = -1 No entry found [dwarf_next_cu_header_c(68)]

file does not contain dwarf type data (try compiling with -g)



All of those also say "ERROR: ctfconvert:" in the front. It would be easier to
notice the important messages if the above 3 types of messages did not also say
ERROR. Then a grep for ERROR would have fewer false positives to go through.


Example messasges, including the ones being reported here:
(The agp_if.o messages are tied to the ctfconvert SIGSEGV case.)

# grep "ERROR" /root/sys_typescripts/typescript_make_powerpc64vtsc_nodebug_incl_clang_xtoolchain_kernel-amd64-host-2016-12-16:14:43:08 | more
ERROR: ctfconvert: die 10273: failed to get ref: No entry found [dwarf_attrval_unsigned(177)]
ERROR: ctfmerge: No ctf sections found to merge
.ERROR_TARGET='agp_if.o'
.ERROR_META_FILE='/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/modules/usr/src/sys/modules/agp/agp_if.o.meta'
.ERROR_TARGET='agp_if.o'
.ERROR_META_FILE='/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/modules/usr/src/sys/modules/agp/agp_if.o.meta'
.ERROR_TARGET='all_subdir_agp'
. . .
ERROR: ctfconvert: die 26932: failed to get ref: No entry found [dwarf_attrval_unsigned(177)]
. . .
ERROR: ctfconvert: die 46063: failed to get ref: No entry found [dwarf_attrval_unsigned(177)]
. . .
ERROR: ctfconvert: die 52618: failed to get ref: No entry found [dwarf_attrval_unsigned(177)]
. . .


Those new dwarf_attrval_unsigned(177) notes are from processing:

sys/modules/accf_http/accf_http.o

sys/modules/acl_posix1e/subr_acl_posix1e.o

sys/modules/ae/if_ae.o

sys/modules/age/if_age.o

(The build stops because of the agp_if.o related SIGSEGV so there
could be more.)
Comment 1 Mark Millard 2016-12-19 21:48:27 UTC
(In reply to Mark Millard from comment #0)

I tried a buildkernel via devel/amd64-gcc and its devel/amd64-binutils and such.

It also gets notices like the example below:

ERROR: ctfconvert: die 23764: failed to get ref: No entry found [dwarf_attrval_unsigned(177)]

This example is from:

--- aac_disk.o ---
Using built-in specs.
COLLECT_GCC=/usr/local/bin/x86_64-unknown-freebsd12.0-gcc
Target: x86_64-unknown-freebsd12.0
Configured with: /usr/obj/portswork/usr/ports/devel/amd64-gcc/work/gcc-6.2.0/configure --target=x86_64-unknown-freebsd12.0 --disable-nls --enable-languages=c,c++ --without-headers --with-gmp=/usr/local --with-pkgversion='FreeBSD Ports Collection for amd64' --with-system-zl
ib --with-gcc-include-dir=/usr/include/c++/v1/ --with-as=/usr/local/bin/x86_64-freebsd-as --with-ld=/usr/local/bin/x86_64-freebsd-ld --prefix=/usr/local --localstatedir=/var --mandir=/usr/local/man --infodir=/usr/local/info/ --build=x86_64-unknown-freebsd12.0
Thread model: posix
gcc version 6.2.0 (FreeBSD Ports Collection for amd64) 
COLLECT_GCC_OPTIONS='-isystem' '/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp/usr/include' '-L/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp/usr/lib' '-B' '/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp/usr/lib' '-B' '/usr/local/x86_64-freebsd/bin/' '-O2' '-pipe'
 '-fno-strict-aliasing' '-Werror' '-D' '_KERNEL' '-D' 'KLD_MODULE' '-nostdinc' '-D' 'HAVE_KERNEL_OPTION_HEADERS' '-include' '/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG/opt_global.h' '-I' '.' '-I' '/usr/src/sys' '-fno-common' '-g' '-fno-omit-frame-point
er' '-mno-omit-leaf-frame-pointer' '-I' '/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG' '-mcmodel=kernel' '-mno-red-zone' '-mno-mmx' '-mno-sse' '-msoft-float' '-fno-asynchronous-unwind-tables' '-ffreestanding' '-fwrapv' '-fstack-protector' '-gdwarf-2' '-W
all' '-Wredundant-decls' '-Wnested-externs' '-Wstrict-prototypes' '-Wmissing-prototypes' '-Wpointer-arith' '-Winline' '-Wcast-qual' '-Wundef' '-Wno-pointer-sign' '-fformat-extensions' '-Wmissing-include-dirs' '-fdiagnostics-show-option' '-Wno-unknown-pragmas' '-Wno-error=a
ddress' '-Wno-error=aggressive-loop-optimizations' '-Wno-error=array-bounds' '-Wno-error=attributes' '-Wno-error=cast-qual' '-Wno-error=enum-compare' '-Wno-error=inline' '-Wno-error=maybe-uninitialized' '-Wno-error=overflow' '-Wno-error=sequence-point' '-Wno-error=strict-o
verflow' '-Wno-error=unused-but-set-variable' '-Wno-error=misleading-indentation' '-Wno-error=nonnull-compare' '-Wno-error=shift-overflow' '-Wno-error=tautological-compare' '-v' '-finline-limit=8000' '-fms-extensions' '--param' 'inline-unit-growth=100' '--param' 'large-fun
ction-growth=1000' '-std=c99' '-c' '-o' 'aac_disk.o' '-mtune=generic' '-march=x86-64'
 /usr/local/libexec/gcc/x86_64-unknown-freebsd12.0/6.2.0/cc1 -quiet -nostdinc -v -I . -I /usr/src/sys -I /usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG -isysroot /usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp -D _KERNEL -D KLD_MODULE -D HAVE_KERNEL_OPTI
ON_HEADERS -isystem /usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp/usr/include -include /usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG/opt_global.h /usr/src/sys/modules/aac/../../dev/aac/aac_disk.c -quiet -dumpbase aac_disk.c -mno-omit-leaf-frame-pointe
r -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float -mtune=generic -march=x86-64 -auxbase-strip aac_disk.o -g -gdwarf-2 -O2 -Werror -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wn
o-pointer-sign -Wmissing-include-dirs -Wno-unknown-pragmas -Wno-error=address -Wno-error=aggressive-loop-optimizations -Wno-error=array-bounds -Wno-error=attributes -Wno-error=cast-qual -Wno-error=enum-compare -Wno-error=inline -Wno-error=maybe-uninitialized -Wno-error=ove
rflow -Wno-error=sequence-point -Wno-error=strict-overflow -Wno-error=unused-but-set-variable -Wno-error=misleading-indentation -Wno-error=nonnull-compare -Wno-error=shift-overflow -Wno-error=tautological-compare -std=c99 -version -fno-strict-aliasing -fno-common -fno-omit
-frame-pointer -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -fformat-extensions -fdiagnostics-show-option -finline-limit=8000 -fms-extensions --param inline-unit-growth=100 --param large-function-growth=1000 -o - |
 /usr/local/bin/x86_64-freebsd-as -v -I . -I /usr/src/sys -I /usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG -o aac_disk.o
GNU C99 (FreeBSD Ports Collection for amd64) version 6.2.0 (x86_64-unknown-freebsd12.0)
        compiled by GNU C version 4.2.1 Compatible FreeBSD Clang 3.9.1 (tags/RELEASE_391/final 289601), GMP version 5.1.3, MPFR version 3.1.5, MPC version 1.0.3, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
#include "..." search starts here:
#include <...> search starts here:
 .
 /usr/src/sys
 /usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG
 /usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp/usr/include
End of search list.
GNU C99 (FreeBSD Ports Collection for amd64) version 6.2.0 (x86_64-unknown-freebsd12.0)
        compiled by GNU C version 4.2.1 Compatible FreeBSD Clang 3.9.1 (tags/RELEASE_391/final 289601), GMP version 5.1.3, MPFR version 3.1.5, MPC version 1.0.3, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 4b2283cf33a9225d87b2fb0e7da88667
. . .
--- aac_disk.o ---
COMPILER_PATH=/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp/usr/lib/:/usr/local/x86_64-freebsd/bin/:/usr/local/libexec/gcc/x86_64-unknown-freebsd12.0/6.2.0/:/usr/local/libexec/gcc/x86_64-unknown-freebsd12.0/6.2.0/:/usr/local/libexec/gcc/x86_64-unknown-freebsd12.0/:/usr
/local/lib/gcc/x86_64-unknown-freebsd12.0/6.2.0/:/usr/local/lib/gcc/x86_64-unknown-freebsd12.0/
LIBRARY_PATH=/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp/usr/lib/:/usr/local/x86_64-freebsd/bin/:/usr/local/lib/gcc/x86_64-unknown-freebsd12.0/6.2.0/:/usr/local/lib/gcc/x86_64-unknown-freebsd12.0/6.2.0/../../../:/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp/lib/:
/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp/usr/lib/
COLLECT_GCC_OPTIONS='-isystem' '/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp/usr/include' '-L/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp/usr/lib' '-B' '/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp/usr/lib' '-B' '/usr/local/x86_64-freebsd/bin/' '-O2' '-pipe'
 '-fno-strict-aliasing' '-Werror' '-D' '_KERNEL' '-D' 'KLD_MODULE' '-nostdinc' '-D' 'HAVE_KERNEL_OPTION_HEADERS' '-include' '/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG/opt_global.h' '-I' '.' '-I' '/usr/src/sys' '-fno-common' '-g' '-fno-omit-frame-point
er' '-mno-omit-leaf-frame-pointer' '-I' '/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG' '-mcmodel=kernel' '-mno-red-zone' '-mno-mmx' '-mno-sse' '-msoft-float' '-fno-asynchronous-unwind-tables' '-ffreestanding' '-fwrapv' '-fstack-protector' '-gdwarf-2' '-W
all' '-Wredundant-decls' '-Wnested-externs' '-Wstrict-prototypes' '-Wmissing-prototypes' '-Wpointer-arith' '-Winline' '-Wcast-qual' '-Wundef' '-Wno-pointer-sign' '-fformat-extensions' '-Wmissing-include-dirs' '-fdiagnostics-show-option' '-Wno-unknown-pragmas' '-Wno-error=a
ddress' '-Wno-error=aggressive-loop-optimizations' '-Wno-error=array-bounds' '-Wno-error=attributes' '-Wno-error=cast-qual' '-Wno-error=enum-compare' '-Wno-error=inline' '-Wno-error=maybe-uninitialized' '-Wno-error=overflow' '-Wno-error=sequence-point' '-Wno-error=strict-o
verflow' '-Wno-error=unused-but-set-variable' '-Wno-error=misleading-indentation' '-Wno-error=nonnull-compare' '-Wno-error=shift-overflow' '-Wno-error=tautological-compare' '-v' '-finline-limit=8000' '-fms-extensions' '--param' 'inline-unit-growth=100' '--param' 'large-fun
ction-growth=1000' '-std=c99' '-c' '-o' 'aac_disk.o' '-mtune=generic' '-march=x86-64'
ERROR: ctfconvert: die 23764: failed to get ref: No entry found [dwarf_attrval_unsigned(177)]
Building /usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG/vnode_if.c
Comment 2 Mark Johnston freebsd_committer freebsd_triage 2016-12-27 01:27:45 UTC
https://reviews.freebsd.org/D8920
Comment 3 commit-hook freebsd_committer freebsd_triage 2016-12-28 21:55:30 UTC
A commit references this bug:

Author: markj
Date: Wed Dec 28 21:54:34 UTC 2016
New revision: 310724
URL: https://svnweb.freebsd.org/changeset/base/310724

Log:
  Follow DW_AT_specification when looking up DW_AT_type attributes.

  dwarf_attrval_*() will search the parent DIE referenced by a
  DW_AT_abstract_origin attribute for the value of the DW_AT_type attribute.
  Do the same thing for the DW_AT_specification attributes in variable
  definitions emitted by GCC 6.2, and ensure that we return an error rather
  than crashing if neither DW_AT_abstract_origin or DW_AT_specification is
  found when looking for the value of the DW_AT_type attribute.

  PR:		215350, 215395
  Reviewed by:	emaste
  MFC after:	2 weeks
  Differential Revision:	https://reviews.freebsd.org/D8920

Changes:
  head/contrib/elftoolchain/libdwarf/dwarf_attrval.c
  head/contrib/elftoolchain/libdwarf/dwarf_attrval_signed.3
Comment 4 Mark Millard 2016-12-30 08:24:12 UTC
(In reply to commit-hook from comment #3)

As of head -r310794 for /usr/src and -r429946 for /usr/ports
I no longer get any ctfconvert notices for "failed to get ref"/

This is true for both amd64 and powerpc64.

I'm guessing this should stay open until the MFC completes
Comment 5 Mark Millard 2016-12-30 08:27:21 UTC
(In reply to Mark Millard from comment #4)

I should have noted that devel/*-gcc had updated to be
6.3.0 based before -r429946 .
Comment 6 Mark Johnston freebsd_committer freebsd_triage 2016-12-30 18:40:59 UTC
(In reply to Mark Millard from comment #4)
Indeed, I'll close the PR once I've finished the MFC.
Comment 7 commit-hook freebsd_committer freebsd_triage 2017-02-03 01:32:31 UTC
A commit references this bug:

Author: markj
Date: Fri Feb  3 01:32:04 UTC 2017
New revision: 313132
URL: https://svnweb.freebsd.org/changeset/base/313132

Log:
  MFC r310724:
  Follow DW_AT_specification when looking up DW_AT_type attributes.

  PR:	215350, 215395

Changes:
_U  stable/11/
  stable/11/contrib/elftoolchain/libdwarf/dwarf_attrval.c
  stable/11/contrib/elftoolchain/libdwarf/dwarf_attrval_signed.3