Bug 215350 - devel/amd64-gcc and devel/powerpc64-gcc -r428888: The 6.2.0 based gcc (indirectly?) gets SIGSEGV building src/sys/modules/agp/agp_if.o but ctfconvert involved
Summary: devel/amd64-gcc and devel/powerpc64-gcc -r428888: The 6.2.0 based gcc (indire...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Baptiste Daroussin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-17 00:06 UTC by Mark Millard
Modified: 2019-01-21 19:25 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (bapt)


Attachments
Example .o file ctfconvert got SIGSEGV with (314.79 KB, application/octet-stream)
2016-12-20 05:17 UTC, Mark Millard
no flags Details
.o that gets a new ERROR message but no ctfconvert crash. (96.45 KB, application/octet-stream)
2016-12-20 05:29 UTC, Mark Millard
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Millard 2016-12-17 00:06:58 UTC
[This is from a amd64 -> powerpc64 cross build.]

This seems to involve ctfconvert, not just powerpc64-gcc

# 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_META_FILE=''
ERROR: ctfconvert: die 26932: failed to get ref: No entry found [dwarf_attrval_unsigned(177)]
.ERROR_TARGET=''
.ERROR_META_FILE=''
.ERROR_TARGET='all_subdir_acl_posix1e'
.ERROR_META_FILE=''
.ERROR_TARGET=''
.ERROR_META_FILE=''
.ERROR_TARGET='all_subdir_acl_nfs4'
.ERROR_META_FILE=''
ERROR: ctfconvert: die 46063: failed to get ref: No entry found [dwarf_attrval_unsigned(177)]
.ERROR_TARGET=''
.ERROR_META_FILE=''
.ERROR_TARGET='all_subdir_ae'
.ERROR_META_FILE=''
ERROR: ctfconvert: die 52618: failed to get ref: No entry found [dwarf_attrval_unsigned(177)]
. . .

First looking at the ERROR_META_FILE contents (same file as listed twice above):

# less /usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/modules/usr/src/sys/modules/agp/agp_if.o.meta
# Meta data file /usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/modules/usr/src/sys/modules/agp/agp_if.o.meta
CMD /usr/local/bin/powerpc64-unknown-freebsd12.0-gcc -isystem /usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/include -L/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib -B/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib --sysroot=/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp -B/usr/local/powerpc64-freebsd/bin/  -O2 -pipe  -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc   -DHAVE_KERNEL_OPTION_HEADERS -include /usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/opt_global.h -I. -I/usr/src/sys -fno-common -g -mlongcall -fno-omit-frame-pointer -I/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG  -mno-altivec -ffreestanding -fwrapv -fstack-protector -gdwarf-2 -Wall -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=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=overflow -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  -v -finline-limit=15000 -fms-extensions --param inline-unit-growth=100 --param large-function-growth=1000 -msoft-float -mcall-aixdesc  -std=iso9899:1999 -c agp_if.c -o agp_if.o
CMD ctfconvert -L VERSION -g agp_if.o
CWD /usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/modules/usr/src/sys/modules/agp
TARGET agp_if.o
-- command output --
Using built-in specs.
COLLECT_GCC=/usr/local/bin/powerpc64-unknown-freebsd12.0-gcc
Target: powerpc64-unknown-freebsd12.0
Configured with: /usr/obj/portswork/usr/ports/devel/powerpc64-gcc/work/gcc-6.2.0/configure --target=powerpc64-unknown-freebsd12.0 --disable-nls --enable-languages=c,c++ --without-headers --with-gmp=/usr/local --with-pkgversion='FreeBSD Ports Collection for powerpc64' --with-system-zlib --with-gcc-include-dir=/usr/include/c++/v1/ --with-as=/usr/local/bin/powerpc64-freebsd-as --with-ld=/usr/local/bin/powerpc64-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 powerpc64) 
COLLECT_GCC_OPTIONS='-isystem' '/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/include' '-L/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib' '-B' '/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib' '-B' '/usr/local/powerpc64-freebsd/bin/' '-O2' '-pipe' '-fno-strict-aliasing' '-Werror' '-D' '_KERNEL' '-D' 'KLD_MODULE' '-nostdinc' '-D' 'HAVE_KERNEL_OPTION_HEADERS' '-include' '/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/opt_global.h' '-I' '.' '-I' '/usr/src/sys' '-fno-common' '-g' '-mlongcall' '-fno-omit-frame-pointer' '-I' '/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG' '-mno-altivec' '-ffreestanding' '-fwrapv' '-fstack-protector' '-gdwarf-2' '-Wall' '-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=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=overflow' '-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' '-v' '-finline-limit=15000' '-fms-extensions' '--param' 'inline-unit-growth=100' '--param' 'large-function-growth=1000' '-msoft-float' '-mcall-aixdesc' '-std=c99' '-c' '-o' 'agp_if.o'
 /usr/local/libexec/gcc/powerpc64-unknown-freebsd12.0/6.2.0/cc1 -quiet -nostdinc -v -I . -I /usr/src/sys -I /usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG -isysroot /usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp -D _KERNEL -D KLD_MODULE -D HAVE_KERNEL_OPTION_HEADERS -isystem /usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/include -include /usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/opt_global.h agp_if.c -quiet -dumpbase agp_if.c -mlongcall -mno-altivec -msoft-float -mcall-aixdesc -auxbase-strip agp_if.o -g -gdwarf-2 -O2 -Werror -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-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=overflow -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 -ffreestanding -fwrapv -fstack-protector -fformat-extensions -fdiagnostics-show-option -finline-limit=15000 -fms-extensions --param inline-unit-growth=100 --param large-function-growth=1000 -o - |
 /usr/local/bin/powerpc64-freebsd-as -v -I . -I /usr/src/sys -I /usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG --traditional-format -a64 -mppc64 -many -o agp_if.o
GNU C99 (FreeBSD Ports Collection for powerpc64) version 6.2.0 (powerpc64-unknown-freebsd12.0)
        compiled by GNU C version 4.2.1 Compatible FreeBSD Clang 3.9.0 (tags/RELEASE_390/final 280324), 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/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG
 /usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/include
End of search list.
GNU C99 (FreeBSD Ports Collection for powerpc64) version 6.2.0 (powerpc64-unknown-freebsd12.0)
        compiled by GNU C version 4.2.1 Compatible FreeBSD Clang 3.9.0 (tags/RELEASE_390/final 280324), 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
GNU assembler version 2.27 (powerpc64-freebsd) using BFD version (GNU Binutils) 2.27
Compiler executable checksum: 4c33be12b12e9d0fcc40f435efb66e04
COMPILER_PATH=/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib/:/usr/local/powerpc64-freebsd/bin/:/usr/local/libexec/gcc/powerpc64-unknown-freebsd12.0/6.2.0/:/usr/local/libexec/gcc/powerpc64-unknown-freebsd12.0/6.2.0/:/usr/local/libexec/gcc/powerpc64-unknown-freebsd12.0/:/usr/local/lib/gcc/powerpc64-unknown-freebsd12.0/6.2.0/:/usr/local/lib/gcc/powerpc64-unknown-freebsd12.0/
LIBRARY_PATH=/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib/:/usr/local/powerpc64-freebsd/bin/:/usr/local/lib/gcc/powerpc64-unknown-freebsd12.0/6.2.0/:/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/lib/:/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib/
COLLECT_GCC_OPTIONS='-isystem' '/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/include' '-L/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib' '-B' '/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib' '-B' '/usr/local/powerpc64-freebsd/bin/' '-O2' '-pipe' '-fno-strict-aliasing' '-Werror' '-D' '_KERNEL' '-D' 'KLD_MODULE' '-nostdinc' '-D' 'HAVE_KERNEL_OPTION_HEADERS' '-include' '/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/opt_global.h' '-I' '.' '-I' '/usr/src/sys' '-fno-common' '-g' '-mlongcall' '-fno-omit-frame-pointer' '-I' '/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG' '-mno-altivec' '-ffreestanding' '-fwrapv' '-fstack-protector' '-gdwarf-2' '-Wall' '-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=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=overflow' '-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' '-v' '-finline-limit=15000' '-fms-extensions' '--param' 'inline-unit-growth=100' '--param' 'large-function-growth=1000' '-msoft-float' '-mcall-aixdesc' '-std=c99' '-c' '-o' 'agp_if.o'
Segmentation fault (core dumped)
*** Error code 139




Despite the above /var/crash/ has only a ctfconvert.21118.core:

# /usr/local/bin/gdb ctfconvert /var/crash/ctfconvert.21118.core 
GNU gdb (GDB) 7.11.1 [GDB v7.11.1 for FreeBSD]
. . .
Reading symbols from ctfconvert...Reading symbols from /usr/lib/debug//usr/bin/ctfconvert.debug...done.
done.
[New LWP 100803]
Core was generated by `ctfconvert -L VERSION -g agp_if.o'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000000000410e52 in strtab_copyin (sp=<optimized out>, str=0x49 <error: Cannot access memory at address 0x49>, len=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/strtab.c:138
138             while (len != 0) {
(gdb) bt
#0  0x0000000000410e52 in strtab_copyin (sp=<optimized out>, str=0x49 <error: Cannot access memory at address 0x49>, len=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/strtab.c:138
#1  strtab_insert (sp=<optimized out>, str=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/strtab.c:193
#2  0x000000000040592b in parseterminate (fmt=0x800a74000 "") at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c:85
#3  0x0000000000405880 in ctf_load (file=<optimized out>, buf=<optimized out>, bufsz=34370992512, si=0x0, label=0x0) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c:1359
#4  0x000000000040412b in ctf_buf_write (p=<optimized out>, n=<error reading variable: Cannot access memory at address 0x8>, b=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c:133
#5  write_unsized_type_rec (b=<optimized out>, ctt=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c:277
#6  write_type (arg1=0x800b02800, arg2=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c:467
#7  0x0000000000403bcc in write_type (arg1=0x800abd140, arg2=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c:412
#8  0x0000000000403641 in compress_start (rb=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c:561
#9  write_compressed_buffer (h=<optimized out>, resszp=<optimized out>, buf=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c:680
#10 ctf_gen (iiburst=0x800a100a0, resszp=0x49c700, do_compress=0) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c:757
#11 0x000000000040035f in ?? ()
#12 0x0000000000000000 in ?? ()
Comment 1 Mark Millard 2016-12-17 01:08:39 UTC
(In reply to Mark Millard from comment #0)

I forgot to list the head (12) version:

# uname -apKU
FreeBSD FreeBSDx64 12.0-CURRENT FreeBSD 12.0-CURRENT #5 r310152M: Fri Dec 16 03:07:37 PST 2016     markmi@FreeBSDx64:/usr/obj/amd64_clang/amd64.amd64/usr/src/sys/GENERIC-NODBG  amd64 amd64 1200019 1200019

# svnlite info /usr/src/ | grep "Re[lpv]"
Relative URL: ^/head
Repository Root: svn://svn.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 310152
Last Changed Rev: 310152

As for /usr/ports/ :

# svnlite info /usr/ports/ | grep "Re[lpv]"
Relative URL: ^/head
Repository Root: svn://svn.freebsd.org/ports
Repository UUID: 35697150-7ecd-e111-bb59-0022644237b5
Revision: 428604
Last Changed Rev: 428604

This is without forcing any older versions of devel/binutils ,
devel/powerpc64-binutils , or other such.

As for SRC_ENV_CONF and the like (this was after kernel-toolchain):

# head ~/sys_typescripts/typescript_make_powerpc64vtsc_nodebug_incl_clang_xtoolchain_kernel-amd64-host-2016-12-16:14:43:08                                                                                                                                                       Script started on Fri Dec 16 14:43:08 2016
Command: env __MAKE_CONF=/root/src.configs/make.conf SRCCONF=/dev/null SRC_ENV_CONF=/root/src.configs/src.conf.powerpc64-xtoolchain.amd64-host WITH_META_MODE=yes MAKEOBJDIRPREFIX=/usr/obj/powerpc64vtsc_xtoolchain_kernel make -j 5 buildkernel
. . .

# more ~/src.configs/src.conf.powerpc64-xtoolchain.amd64-host
TO_TYPE=powerpc64
TOOLS_TO_TYPE=${TO_TYPE}
VERSION_CONTEXT=12.0
#
KERNCONF=GENERIC64vtsc-NODBG
TARGET=powerpc
.if ${.MAKE.LEVEL} == 0
TARGET_ARCH=${TO_TYPE}
.export TARGET_ARCH
.endif
#
WITHOUT_CROSS_COMPILER=
WITHOUT_SYSTEM_COMPILER=
#
WITH_LIBCPLUSPLUS=
WITHOUT_BINUTILS_BOOTSTRAP=
WITHOUT_CLANG_BOOTSTRAP=
WITH_CLANG=
WITH_CLANG_IS_CC=
WITH_CLANG_FULL=
WITH_CLANG_EXTRAS=
WITH_LLDB=
#
WITH_BOOT=
# powerpc64 LIB32 builds via gcc 4.9 or later variants that I've tried
# but the LIB32 does not work [crtbeginS code problem(s)]
WITHOUT_LIB32=
#
WITHOUT_ELFTOOLCHAIN_BOOTSTRAP=
WITHOUT_GCC_BOOTSTRAP=
WITHOUT_GCC=
WITHOUT_GCC_IS_CC=
WITHOUT_GNUCXX=
#
NO_WERROR=
#WERROR=
MALLOC_PRODUCTION=
#
WITH_DEBUG_FILES=
#
#
# For TO (so-called "cross") stages . . .
# So-called-cross via ${TO_TYPE}-xtoolchain-gcc/${TO_TYPE}-gcc. . .
# TOOLS_TO_TYPE based on ${TO_TYPE}-xtoolchain-gcc related binutils. . .
#
CROSS_TOOLCHAIN=${TO_TYPE}-gcc
X_COMPILER_TYPE=gcc
CROSS_BINUTILS_PREFIX=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/
.if ${.MAKE.LEVEL} == 0
XCC=/usr/local/bin/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}-gcc
XCXX=/usr/local/bin/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}-g++
XCPP=/usr/local/bin/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}-cpp
.export XCC
.export XCXX
.export XCPP
XAS=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/as
XAR=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/ar
XLD=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/ld
XNM=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/nm
XOBJCOPY=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/objcopy
XOBJDUMP=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/objdump
XRANLIB=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/ranlib
XSIZE=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/size
#NO-SUCH: XSTRINGS=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/strings
XSTRINGS=/usr/local/bin/${TOOLS_TO_TYPE}-freebsd-strings
.export XAS
.export XAR
.export XLD
.export XNM
.export XOBJCOPY
.export XOBJDUMP
.export XRANLIB
.export XSIZE
.export XSTRINGS
.endif
#
#
# From based on clang (via system). . .
#
.if ${.MAKE.LEVEL} == 0
CC=/usr/bin/clang
CXX=/usr/bin/clang++
CPP=/usr/bin/clang-cpp
.export CC
.export CXX
.export CPP
.endif

# more ~/src.configs/make.conf 
CFLAGS.gcc+= -v
Comment 2 Mark Millard 2016-12-17 04:03:48 UTC
(In reply to Mark Millard from comment #1)
Looking around in the typescript output makes it look like the ctfconvert
"die . . ." notices are from sys/modules/accf_http/accf_http.kld activity

I remind that there was only one ctfconvert.*.core from the run and I do
not know that it was from one of the below: it might be from something not
explicitly listed in the typescript.

The following are what the typescript shows for where

ERROR: ctfmerge:

occurred. . .

--- all_subdir_accf_http ---
COMPILER_PATH=/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib/:/usr/local/powerpc64-freebsd/bin/:/usr/local/libexec/gcc/powerpc64-unknown-freebsd12.0/6.2.0/:/usr/local/libexec/gcc/powerpc64-unknown-freebsd12.0/6.2.0/:/usr/local/libexec/gcc/po
werpc64-unknown-freebsd12.0/:/usr/local/lib/gcc/powerpc64-unknown-freebsd12.0/6.2.0/:/usr/local/lib/gcc/powerpc64-unknown-freebsd12.0/
LIBRARY_PATH=/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib/:/usr/local/powerpc64-freebsd/bin/:/usr/local/lib/gcc/powerpc64-unknown-freebsd12.0/6.2.0/:/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/lib/:/usr/obj/power
pc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib/
COLLECT_GCC_OPTIONS='-isystem' '/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/include' '-L/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib' '-B' '/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/t
mp/usr/lib' '-B' '/usr/local/powerpc64-freebsd/bin/' '-O2' '-pipe' '-fno-strict-aliasing' '-Werror' '-D' '_KERNEL' '-D' 'KLD_MODULE' '-nostdinc' '-D' 'HAVE_KERNEL_OPTION_HEADERS' '-include' '/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vt
sc-NODBG/opt_global.h' '-I' '.' '-I' '/usr/src/sys' '-fno-common' '-g' '-mlongcall' '-fno-omit-frame-pointer' '-I' '/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG' '-mno-altivec' '-ffreestanding' '-fwrapv' '-fstack-protector' '-g
dwarf-2' '-Wall' '-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=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=overflow' '-Wno-error=sequence-point' '-Wno-er
ror=strict-overflow' '-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=15000' '-fms-extensions' '--param' 'inline-unit-growth=100' '--para
m' 'large-function-growth=1000' '-msoft-float' '-mcall-aixdesc' '-std=c99' '-c' '-o' 'accf_http.o'
ERROR: ctfconvert: die 10273: failed to get ref: No entry found [dwarf_attrval_unsigned(177)]
Building /usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/modules/usr/src/sys/modules/accf_http/accf_http.kld
. . .
--- accf_http.kld ---
ERROR: ctfmerge: No ctf sections found to merge
. . .


Note: The following are from examples of:

A failure has been detected in another branch of the parallel make



--- all_subdir_acl_posix1e ---
COMPILER_PATH=/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib/:/usr/local/powerpc64-freebsd/bin/:/usr/local/libexec/gcc/powerpc64-unknown-freebsd12.0/6.2.0/:/usr/local/libexec/gcc/powerpc64-unknown-freebsd12.0/6.2.0/:/usr/local/libexec/gcc/po
werpc64-unknown-freebsd12.0/:/usr/local/lib/gcc/powerpc64-unknown-freebsd12.0/6.2.0/:/usr/local/lib/gcc/powerpc64-unknown-freebsd12.0/
LIBRARY_PATH=/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib/:/usr/local/powerpc64-freebsd/bin/:/usr/local/lib/gcc/powerpc64-unknown-freebsd12.0/6.2.0/:/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/lib/:/usr/obj/power
pc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib/
COLLECT_GCC_OPTIONS='-isystem' '/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/include' '-L/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib' '-B' '/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/t
mp/usr/lib' '-B' '/usr/local/powerpc64-freebsd/bin/' '-O2' '-pipe' '-fno-strict-aliasing' '-Werror' '-D' '_KERNEL' '-D' 'KLD_MODULE' '-nostdinc' '-D' 'HAVE_KERNEL_OPTION_HEADERS' '-include' '/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vt
sc-NODBG/opt_global.h' '-I' '.' '-I' '/usr/src/sys' '-fno-common' '-g' '-mlongcall' '-fno-omit-frame-pointer' '-I' '/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG' '-mno-altivec' '-ffreestanding' '-fwrapv' '-fstack-protector' '-g
dwarf-2' '-Wall' '-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=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=overflow' '-Wno-error=sequence-point' '-Wno-er
ror=strict-overflow' '-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=15000' '-fms-extensions' '--param' 'inline-unit-growth=100' '--para
m' 'large-function-growth=1000' '-msoft-float' '-mcall-aixdesc' '-std=c99' '-c' '-o' 'subr_acl_posix1e.o'
ERROR: ctfconvert: die 26932: failed to get ref: No entry found [dwarf_attrval_unsigned(177)]


--- all_subdir_acl_nfs4 ---
COMPILER_PATH=/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib/:/usr/local/powerpc64-freebsd/bin/:/usr/local/libexec/gcc/powerpc64-unknown-freebsd12.0/6.2.0/:/usr/local/libexec/gcc/powerpc64-unknown-freebsd12.0/6.2.0/:/usr/local/libexec/gcc/powerpc64-unknown-freebsd12.0/:/usr/local/lib/gcc/powerpc64-unknown-freebsd12.0/6.2.0/:/usr/local/lib/gcc/powerpc64-unknown-freebsd12.0/
LIBRARY_PATH=/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib/:/usr/local/powerpc64-freebsd/bin/:/usr/local/lib/gcc/powerpc64-unknown-freebsd12.0/6.2.0/:/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/lib/:/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib/
COLLECT_GCC_OPTIONS='-isystem' '/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/include' '-L/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib' '-B' '/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib' '-B' '/usr/local/powerpc64-freebsd/bin/' '-O2' '-pipe' '-fno-strict-aliasing' '-Werror' '-D' '_KERNEL' '-D' 'KLD_MODULE' '-nostdinc' '-D' 'HAVE_KERNEL_OPTION_HEADERS' '-include' '/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/opt_global.h' '-I' '.' '-I' '/usr/src/sys' '-fno-common' '-g' '-mlongcall' '-fno-omit-frame-pointer' '-I' '/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG' '-mno-altivec' '-ffreestanding' '-fwrapv' '-fstack-protector' '-gdwarf-2' '-Wall' '-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=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=overflow' '-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' '-v' '-finline-limit=15000' '-fms-extensions' '--param' 'inline-unit-growth=100' '--param' 'large-function-growth=1000' '-msoft-float' '-mcall-aixdesc' '-std=c99' '-c' '-o' 'subr_acl_nfs4.o'
A failure has been detected in another branch of the parallel make

make[4]: stopped in /usr/src/sys/modules/acl_nfs4
...skipping...
ERROR: ctfconvert: die 46063: failed to get ref: No entry found [dwarf_attrval_unsigned(177)]


--- all_subdir_age ---
COMPILER_PATH=/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib/:/usr/local/powerpc64-freebsd/bin/:/usr/local/libexec/gcc/powerpc64-unknown-freebsd12.0/6.2.0/:/usr/local/libexec/gcc/powerpc64-unknown-freebsd12.0/6.2.0/:/usr/local/libexec/gcc/powerpc64-unknown-freebsd12.0/:/usr/local/lib/gcc/powerpc64-unknown-freebsd12.0/6.2.0/:/usr/local/lib/gcc/powerpc64-unknown-freebsd12.0/
LIBRARY_PATH=/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib/:/usr/local/powerpc64-freebsd/bin/:/usr/local/lib/gcc/powerpc64-unknown-freebsd12.0/6.2.0/:/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/lib/:/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib/
COLLECT_GCC_OPTIONS='-isystem' '/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/include' '-L/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib' '-B' '/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/lib' '-B' '/usr/local/powerpc64-freebsd/bin/' '-O2' '-pipe' '-fno-strict-aliasing' '-Werror' '-D' '_KERNEL' '-D' 'KLD_MODULE' '-nostdinc' '-D' 'HAVE_KERNEL_OPTION_HEADERS' '-include' '/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/opt_global.h' '-I' '.' '-I' '/usr/src/sys' '-fno-common' '-g' '-mlongcall' '-fno-omit-frame-pointer' '-I' '/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG' '-mno-altivec' '-ffreestanding' '-fwrapv' '-fstack-protector' '-gdwarf-2' '-Wall' '-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=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=overflow' '-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' '-v' '-finline-limit=15000' '-fms-extensions' '--param' 'inline-unit-growth=100' '--param' 'large-function-growth=1000' '-msoft-float' '-mcall-aixdesc' '-std=c99' '-c' '-o' 'if_age.o'
ERROR: ctfconvert: die 52618: failed to get ref: No entry found [dwarf_attrval_unsigned(177)]
Comment 3 Mark Millard 2016-12-17 05:03:04 UTC
(In reply to Mark Millard from comment #2)

Enabling or disabling RELRO in devel/powerpc64-binutils seems to have
made no difference in the result.

Still only one ctfconvert.*.core produced per try.
Comment 4 Baptiste Daroussin freebsd_committer freebsd_triage 2016-12-17 11:55:02 UTC
Weird I have just tried and cross built successfully the kernel for powerpc64 using powerpc64-xtoolchain-gcc
Comment 5 Mark Millard 2016-12-17 23:32:12 UTC
(In reply to Baptiste Daroussin from comment #4)

I just tried running ctfconvert from inside gdb and it gives a different
backtrace. I show it later below. My original bt report used the wrong
ctfconvert with the .core file and so misinterpreted the debug information.

While I have devel/dwarfdump installed, and so had devel/libdwarf at
installation time, libdwarf is not installed and so there were no
/usr/local/include/ dwarf files to interfere. (A problem I've observed in
the past and had to control.)

I actually show two backtraces, one each for explicitly running:

/usr/obj/powerpc64vtsc_xtoolchain/powerpc.powerpc64/usr/src/tmp/usr/bin/ctfconvert
(which does not have debug information)
vs.
/usr/bin/ctfconvert
(which has debug information)

But get the SIGSEGV in the same routine.

# /usr/local/bin/gdb /usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/bin/ctfconvert
. . .
Reading symbols from /usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/bin/ctfconvert...(no debugging symbols found)...done.
(gdb) run -L VERSION /usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/modules/usr/src/sys/modules/agp/agp_if.o
Starting program: /usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/tmp/usr/bin/ctfconvert -L VERSION /usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/modules/usr/src/sys/modules/agp/agp_if.o

Program received signal SIGSEGV, Segmentation fault.
0x0000000000410e52 in dwarf_attrval_unsigned ()
(gdb) bt
#0  0x0000000000410e52 in dwarf_attrval_unsigned ()
#1  0x000000000040592b in die_lookup_pass1 ()
#2  0x0000000000405880 in die_variable_create ()
#3  0x000000000040412b in die_create_one ()
#4  0x0000000000403bcc in dw_read ()
#5  0x0000000000403641 in main ()


The following seems to have a similar bt but also shows: die_attr_ref
(via the debug information giving extra context)
This trace is likely more useful.

# /usr/local/bin/gdb ctfconvert 
GNU gdb (GDB) 7.11.1 [GDB v7.11.1 for FreeBSD]
. . .
(gdb) run -L VERSION /usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/modules/usr/src/sys/modules/agp/agp_if.o
Starting program: /usr/bin/ctfconvert -L VERSION /usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/modules/usr/src/sys/modules/agp/agp_if.o

Program received signal SIGSEGV, Segmentation fault.
dwarf_attrval_unsigned (die=<optimized out>, attr=<optimized out>, valp=0x7fffffffdf30, err=0x7fffffffe0b8) at /usr/src/contrib/elftoolchain/libdwarf/dwarf_attrval.c:187
187             switch (at->at_form) {
(gdb) bt
#0  dwarf_attrval_unsigned (die=<optimized out>, attr=<optimized out>, valp=0x7fffffffdf30, err=0x7fffffffe0b8) at /usr/src/contrib/elftoolchain/libdwarf/dwarf_attrval.c:187
#1  0x0000000000408396 in die_attr_ref (name=73, dw=<optimized out>, die=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:417
#2  die_lookup_pass1 (dw=<optimized out>, die=<optimized out>, name=73) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:476
#3  0x00000000004082cb in die_variable_create (dw=0x7fffffffe0b0, die=0x8018ff900, off=<optimized out>, tdp=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1657
#4  0x0000000000406a46 in die_create_one (dw=0x7fffffffe0b0, die=0x8018ff900) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1770
#5  0x000000000040646d in die_create (die=<optimized out>, dw=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1777
#6  dw_read (td=<optimized out>, elf=<optimized out>, filename=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1980
#7  0x0000000000405ea1 in file_read (td=0x80181c000, filename=0x7fffffffe8cf "/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/modules/usr/src/sys/modules/agp/agp_if.o", ignore_non_c=0)
    at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/ctfconvert.c:115
#8  main (argc=<optimized out>, argv=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/ctfconvert.c:236
Comment 6 Mark Millard 2016-12-17 23:44:38 UTC
(In reply to Baptiste Daroussin from comment #4)

For your context for comparison: outputs for the build context for. . .

uname -apKU

svnlite info /usr/src (or equivalent) | grep "Re[plv]"

svnlite info /usr/ports (or equivalent) | grep "Re[plv]"

Do you have devel/libdwarf installed?

(Historically xtoolchain based builds would pick these up in buildworld via
implicit /usr/local/include use in gcc. The compiler -v output in the logs
here indicate that should not be a problem in my context --but I do
not have devel/libdwarf installed anyway. I do have devel/dwarfdump installed.
I build from source.)
Comment 7 Mark Millard 2016-12-18 00:08:12 UTC
(In reply to Mark Millard from comment #5)

Even a ctfconvert from an old 2016-Nov-7 build fails the same way on that file.

dwarfdump -ka -kxe reports the following, including 2 errors:
(You might try such on your modules/usr/src/sys/modules/agp/agp_if.o (for example).)

*** DWARF CHECK: DW_TAG_subprogram -> DW_AT_GNU_all_call_sites: check the tag-attr combination ***
and. . .
*** DWARF CHECK: .debug_line: standard DWARF3 operands matched, but is DWARF2 linetable at offset 0x00000000  ( 0 ) ***

The full output:

# dwarfdump -ka -kxe /usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/modules/usr/src/sys/modules/agp/agp_if.o | more

*** DWARF CHECK: DW_TAG_subprogram -> DW_AT_GNU_all_call_sites: check the tag-attr combination ***

CU Name = agp_if.c
CU Producer = GNU C99 6.2.0 -mlongcall -mno-altivec -msoft-float -mcall-aixdesc -g -gdwarf-2 -O2 -std=c99 -fno-strict-aliasing -fno-common -fno-omit-frame-pointer -ffreestanding -fwrapv -fstack-protector -fformat-extensions -finline-limit=15000 -fms-extensions --param inline-unit-growth=100 --param large-function-growth=1000
DIE OFF = 0x00001635 GOFF = 0x00001635, Low PC = 0x00000000, High PC = 0x00000028
DW_AT_GNU_all_call_sites    yes(1)

*** DWARF CHECK: .debug_line: standard DWARF3 operands matched, but is DWARF2 linetable at offset 0x00000000  ( 0 ) ***

CU Name = agp_if.c
CU Producer = GNU C99 6.2.0 -mlongcall -mno-altivec -msoft-float -mcall-aixdesc -g -gdwarf-2 -O2 -std=c99 -fno-strict-aliasing -fno-common -fno-omit-frame-pointer -ffreestanding -fwrapv -fstack-protector -fformat-extensions -finline-limit=15000 -fms-extensions --param inline-unit-growth=100 --param large-function-growth=1000
DIE OFF = 0x00001656 GOFF = 0x00001656, Low PC = 0x00000000, High PC = 0x00000028
Record = 0 Addr = 0x00000000 [  23, 0] '/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/modules/usr/src/sys/modules/agp/agp_if.c'

1 Compilers detected:
01: GNU C99 6.2.0 -mlongcall -mno-altivec -msoft-float -mcall-aixdesc -g -gdwarf-2 -O2 -std=c99 -fno-strict-aliasing -fno-common -fno-omit-frame-pointer -ffreestanding -fwrapv -fstack-protector -fformat-extensions -finline-limit=15000 -fms-extensions --param inline-unit-growth=100 --param large-function-growth=1000

1 Compilers verified:
01: errors =     2, GNU C99 6.2.0 -mlongcall -mno-altivec -msoft-float -mcall-aixdesc -g -gdwarf-2 -O2 -std=c99 -fno-strict-aliasing -fno-common -fno-omit-frame-pointer -ffreestanding -fwrapv -fstack-protector -fformat-extensions -finline-limit=15000 -fms-extensions --param inline-unit-growth=100 --param large-function-growth=1000

*** TOTAL ERRORS FOR ALL COMPILERS ***

DWARF CHECK RESULT
<item>                    <checks>    <errors>
pubname_attr                     0           0
attr_tag                      2124           1
tag_tree                       479           0
type_offset                    793           0
decl_file                      362           0
ranges                           2           0
line_table                       6           1
fde table                        1           0
aranges                          4           0
names                          367           0
locations                        6           0
harmless_errors                  0           0
abbreviations                  958           0
dwarf_constants               5573           0
debug_info_gaps                433           0
forward_declarations            11           0
self_references                804           0
attr_encoding                  790           0
** Summarize **              12713           2
Comment 8 Mark Millard 2016-12-18 00:35:30 UTC
(In reply to Mark Millard from comment #7)

As for the other files where ctfconvert reported dwarf die information
problems, saying:

failed to get ref: No entry found [dwarf_attrval_unsigned(177)]

more errors are reported by dwarfdump, taking an example:

dwarfdump -ka -kxe /usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/modules/usr/src/sys/modules/accf_http/accf_http.o | more
. . .
*** TOTAL ERRORS FOR ALL COMPILERS ***

DWARF CHECK RESULT
<item>                    <checks>    <errors>
pubname_attr                     0           0
attr_tag                      3764          82
tag_tree                      1008          42
type_offset                   1379           0
decl_file                      782           0
ranges                          40           0
line_table                     195           1
fde table                        5           0
aranges                          4           0
names                          669           0
locations                      278           0
harmless_errors                  0           0
abbreviations                 2016           0
dwarf_constants              10413           0
debug_info_gaps                868           0
forward_declarations             0           0
self_references               1475           0
attr_encoding                 1340           0
** Summarize **              24236         125
. . .

There are other messages not in the prior agp_if.o swarfdump output,
such as:

*** DWARF CHECK: DW_TAG_subprogram -> DW_AT_GNU_all_call_sites: check the tag-attr combination ***

*** DWARF CHECK: DW_TAG_lexical_block -> DW_TAG_GNU_call_site: tag-tree relation is not standard. ***

*** DWARF CHECK: DW_TAG_GNU_call_site_parameter -> DW_AT_location: check the tag-attr combination ***



If I use just the DIE related -k<?>'s the result is only a summary:

dwarfdump -kb -kr -kR -ks -kS /usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/modules/usr/src/sys/modules/accf_http/accf_http.o | more

1 Compilers detected:
01: GNU C99 6.2.0 -mlongcall -mno-altivec -msoft-float -mcall-aixdesc -g -gdwarf-2 -O2 -std=c99 -fno-strict-aliasing -fno-common -fno-omit-frame-pointer -ffreestanding -fwrapv -fstack-protector -fformat-extensions -finline-limit=15000 -fms-extensions --param inline-unit-growth=100 --param large-function-growth=1000

1 Compilers verified:
01: errors =    82, GNU C99 6.2.0 -mlongcall -mno-altivec -msoft-float -mcall-aixdesc -g -gdwarf-2 -O2 -std=c99 -fno-strict-aliasing -fno-common -fno-omit-frame-pointer -ffreestanding -fwrapv -fstack-protector -fformat-extensions -finline-limit=15000 -fms-extensions --param inline-unit-growth=100 --param large-function-growth=1000

*** TOTAL ERRORS FOR ALL COMPILERS ***

DWARF CHECK RESULT
<item>                    <checks>    <errors>
attr_tag                      3764          82
harmless_errors                  0           0
abbreviations                 2016           0
forward_declarations             0           0
self_references               1475           0
** Summarize **               7255          82
Comment 9 Mark Millard 2016-12-18 02:17:31 UTC
(In reply to Mark Millard from comment #8)

The ctfconvert 's that do not get SYSSEGV but terminate early with an
error message do so in:

static Dwarf_Off
die_attr_ref(dwarf_t *dw, Dwarf_Die die, Dwarf_Half name)
{
        Dwarf_Off off;

        if (dwarf_attrval_unsigned(die, name, &off, &dw->dw_err) != DW_DLV_OK) {
                terminate("die %llu: failed to get ref: %s\n",
                    die_off(dw, die), dwarf_errmsg(dw->dw_err));
        }

        return (off);
}

with backtraces that look like:
(like the SIGSEGV case but dwarf_attrval_unsigned managed to complete
instead)

(gdb) bt
#0  terminate (format=0x4134a6 "die %llu: failed to get ref: %s\n") at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/util.c:142
#1  0x000000000040842a in die_attr_ref (name=73, dw=<optimized out>, die=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:418
#2  die_lookup_pass1 (dw=<optimized out>, die=<optimized out>, name=73) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:476
#3  0x00000000004082cb in die_variable_create (dw=0x7fffffffe0c0, die=0x80197b400, off=<optimized out>, tdp=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1657
#4  0x0000000000406a46 in die_create_one (dw=0x7fffffffe0c0, die=0x80197b400) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1770
#5  0x0000000000407064 in die_create (die=<optimized out>, dw=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1777
#6  die_lexblk_descend (dw=<optimized out>, die=<optimized out>, off=<optimized out>, tdp=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1689
#7  0x0000000000406a46 in die_create_one (dw=0x7fffffffe0c0, die=0x80197b300) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1770
#8  0x0000000000407064 in die_create (die=<optimized out>, dw=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1777
#9  die_lexblk_descend (dw=<optimized out>, die=<optimized out>, off=<optimized out>, tdp=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1689
#10 0x0000000000406a46 in die_create_one (dw=0x7fffffffe0c0, die=0x80197b100) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1770
#11 0x0000000000407bed in die_function_create (dw=<optimized out>, die=<optimized out>, off=10003, tdp=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1570
#12 0x0000000000406a46 in die_create_one (dw=0x7fffffffe0c0, die=0x801973700) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1770
#13 0x000000000040646d in die_create (die=<optimized out>, dw=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1777
#14 dw_read (td=<optimized out>, elf=<optimized out>, filename=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1980
#15 0x0000000000405ea1 in file_read (td=0x80181c000, filename=0x7fffffffe8d7 "/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/modules/usr/src/sys/modules/accf_http/accf_http.o", ignore_non_c=0)
    at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/ctfconvert.c:115
#16 main (argc=<optimized out>, argv=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/ctfconvert.c:236


Here is a trace for when _dwarf_set_error was called before generating the dwarf die problem message:

(gdb) bt
#0  _dwarf_set_error (dbg=0x801874000, error=0x7fffffffe0c8, errorcode=4, elferrorcode=0, functionname=0x80085fc65 "dwarf_attrval_unsigned", linenumber=177) at /usr/src/contrib/elftoolchain/libdwarf/libdwarf_error.c:37
#1  0x000000080084a54e in dwarf_attrval_unsigned (die=<optimized out>, attr=<optimized out>, valp=0x7fffffffdc90, err=0x7fffffffe0c8) at /usr/src/contrib/elftoolchain/libdwarf/dwarf_attrval.c:159
#2  0x0000000000408396 in die_attr_ref (name=73, dw=<optimized out>, die=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:417
#3  die_lookup_pass1 (dw=<optimized out>, die=<optimized out>, name=73) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:476
#4  0x00000000004082cb in die_variable_create (dw=0x7fffffffe0c0, die=0x80197b400, off=<optimized out>, tdp=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1657
#5  0x0000000000406a46 in die_create_one (dw=0x7fffffffe0c0, die=0x80197b400) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1770
#6  0x0000000000407064 in die_create (die=<optimized out>, dw=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1777
#7  die_lexblk_descend (dw=<optimized out>, die=<optimized out>, off=<optimized out>, tdp=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1689
#8  0x0000000000406a46 in die_create_one (dw=0x7fffffffe0c0, die=0x80197b300) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1770
#9  0x0000000000407064 in die_create (die=<optimized out>, dw=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1777
#10 die_lexblk_descend (dw=<optimized out>, die=<optimized out>, off=<optimized out>, tdp=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1689
#11 0x0000000000406a46 in die_create_one (dw=0x7fffffffe0c0, die=0x80197b100) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1770
#12 0x0000000000407bed in die_function_create (dw=<optimized out>, die=<optimized out>, off=10003, tdp=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1570
#13 0x0000000000406a46 in die_create_one (dw=0x7fffffffe0c0, die=0x801973700) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1770
#14 0x000000000040646d in die_create (die=<optimized out>, dw=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1777
#15 dw_read (td=<optimized out>, elf=<optimized out>, filename=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1980
#16 0x0000000000405ea1 in file_read (td=0x80181c000, filename=0x7fffffffe8d7 "/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/modules/usr/src/sys/modules/accf_http/accf_http.o", ignore_non_c=0)
    at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/ctfconvert.c:115
#17 main (argc=<optimized out>, argv=<optimized out>) at /usr/src/cddl/usr.bin/ctfconvert/../../../cddl/contrib/opensolaris/tools/ctf/cvt/ctfconvert.c:236
Comment 10 Mark Millard 2016-12-18 02:22:06 UTC
(In reply to Mark Millard from comment #9)

I have isolated the SIGSEGV code path:

/usr/src/contrib/elftoolchain/libdwarf/dwarf_attrval.c has code in
dwarf_attrval_unsigned of the form:

        if (at == NULL &&
            (at = _dwarf_attr_find(die, DW_AT_abstract_origin)) != NULL) {
. . .
        }

        switch (at->at_form) {

but if the "at = _dwarf. . ." ends up with at==NULL the switch will try
to dereference off the NULL and cause the SIGSEGV.
Comment 11 Mark Millard 2016-12-18 03:16:24 UTC
A side note relative to ctfconvert messages in build logs. . .

My archive of typescripts for buildkernel and the like goes back into
2016-July currently.

Prior to the switch to powerpc64-gcc being based on 6.2.0 none of the
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.



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.
Comment 12 Mark Millard 2016-12-18 21:44:55 UTC
Turns out that although the new 6.2.0 powerpc64-gcc output finally touched the
problem, the SIGSEGV code path is actually from base system code:

/usr/src/contrib/elftoolchain/libdwarf/dwarf_attrval.c

(See comment 10.)

So I'm trying to switch from Ports & Packages to Base System.

However, the Component field still only lists ports options. May be I can change
that after a Save Changes and then save again? We will see.



WARNING: Much of the comments for here (215350) are inappropriate to the SIGSEGV
specifics that I eventually found while exploring ctfconvert oddities.

A separate submittal is appropriate for the new cases of ctfconvert aborting
with error messages (but not crashing).
Comment 13 Mark Millard 2016-12-18 23:00:07 UTC
This defect (215350) is now just for the problem in ctfconvert's libddwarf
that gets a SIGSEGV for a specific code path in dwarf_attrval.c 's
dwarf_attrval_unsigned. (6.2.0 based powerpc64-gcc output can cause this
path to happen.)

I submitted 215395 for the new ctfconvert messages associated with ctfconvert
aborting early by calling its terminate(. . .) for some modern 6.2.0 .o files
from the modern devel/powerpc64-gcc .
Comment 14 Mark Millard 2016-12-19 21:53:46 UTC
(In reply to Mark Millard from comment #13)

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

It also gets SIGSEGV's in ctfconvert, leaving .core files. And example is for:

--- all_subdir_aacraid ---
Segmentation fault (core dumped)
*** [aacraid.o] Error code 139



# Meta data file /usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG/modules/usr/src/sys/modules/aacraid/aacraid.o.meta
CMD /usr/local/bin/x86_64-unknown-freebsd12.0-gcc -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 --sysroot=/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp -B/usr/local/x86_64-freebsd/bin/  -O2 -pipe  -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc   -DHAVE_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-pointer -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 -Wall -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=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=overflow -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  -v -finline-limit=8000 -fms-extensions --param inline-unit-growth=100 --param large-function-growth=1000  -std=iso9899:1999 -c /usr/src/sys/modules/aacraid/../../dev/aacraid/aacraid.c -o aacraid.o
CMD ctfconvert -L VERSION -g aacraid.o
CWD /usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG/modules/usr/src/sys/modules/aacraid
TARGET aacraid.o
-- command output --
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-zlib --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-pointer' '-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' '-Wall' '-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=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=overflow' '-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' '-v' '-finline-limit=8000' '-fms-extensions' '--param' 'inline-unit-growth=100' '--param' 'large-function-growth=1000' '-std=c99' '-c' '-o' 'aacraid.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_OPTION_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/aacraid/../../dev/aacraid/aacraid.c -quiet -dumpbase aacraid.c -mno-omit-leaf-frame-pointer -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float -mtune=generic -march=x86-64 -auxbase-strip aacraid.o -g -gdwarf-2 -O2 -Werror -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-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=overflow -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 aacraid.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
GNU assembler version 2.27 (x86_64-freebsd) using BFD version (GNU Binutils) 2.27
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 4b2283cf33a9225d87b2fb0e7da88667
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-pointer' '-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' '-Wall' '-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=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=overflow' '-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' '-v' '-finline-limit=8000' '-fms-extensions' '--param' 'inline-unit-growth=100' '--param' 'large-function-growth=1000' '-std=c99' '-c' '-o' 'aacraid.o' '-mtune=generic' '-march=x86-64'
Segmentation fault (core dumped)
*** Error code 139
Comment 15 Ed Maste freebsd_committer freebsd_triage 2016-12-20 02:56:07 UTC
Is it possible to attach an object file and provide a ctfconvert command line that reproduces the issue?
Comment 16 Mark Millard 2016-12-20 05:17:37 UTC
Created attachment 178128 [details]
Example .o file ctfconvert got SIGSEGV with

ctfconvert -L VERSION aac.o

should do what the following did on my system:

# ctfconvert -L VERSION /usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG/modules/usr/src/sys/modules/aac/aac.o
Segmentation fault (core dumped)

# which ctfconvert
/usr/bin/ctfconvert

# uname -apKU
FreeBSD FreeBSDx64 12.0-CURRENT FreeBSD 12.0-CURRENT #6 r310236M: Sun Dec 18 17:12:36 PST 2016     markmi@FreeBSDx64:/usr/obj/amd64_clang/amd64.amd64/usr/src/sys/GENERIC-NODBG  amd64 amd64 1200019 1200019
Comment 17 Mark Millard 2016-12-20 05:29:45 UTC
Created attachment 178130 [details]
.o that gets a new ERROR message but no ctfconvert crash.

This .o does not lead to a ctfconvert crash but gives a type of ERROR
message I've not seen until 6.2.0 of devel/*-gcc was put in place:

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

bugzilla 215395 is about these new messages.
Comment 18 Mark Millard 2016-12-20 21:30:53 UTC
(In reply to Ed Maste from comment #15)

I have discovered something from /var/log/messages* and my script logs
of the builds:

With 4 GByte RAM and 2 GByte swap for the amd64 host and buildworld
based on devel/*-gcc based on 6.2.0 the -j 5 build attempt on a 
4 core environment is getting notices:

Dec 16 18:32:30 FreeBSDx64 kernel: swap_pager: out of swap space
Dec 16 18:32:30 FreeBSDx64 kernel: swap_pager_getswapspace(2): failed
Dec 16 18:32:38 FreeBSDx64 kernel: swap_pager_getswapspace(1): failed
. . .

Dec 16 22:31:55 FreeBSDx64 kernel: swap_pager: out of swap space
Dec 16 22:31:55 FreeBSDx64 kernel: swap_pager_getswapspace(3): failed
Dec 16 22:31:58 FreeBSDx64 kernel: swap_pager_getswapspace(4): failed
. . .

Dec 19 01:13:17 FreeBSDx64 kernel: swap_pager: out of swap space
Dec 19 01:13:17 FreeBSDx64 kernel: swap_pager_getswapspace(12): failed
Dec 19 01:13:18 FreeBSDx64 kernel: swap_pager_getswapspace(15): failed
. . .

These span both amd64 -> powerpc64 cross builds and amd64 -> amd64 builds.

Apparently the memory requirements have increased. This was not obvious
while doing the build.

My context for amd64 is running FreeBSD in a VirtualBox virtual
machine (historically given 4 GBytes) and I happen to have choosen zfs.
Zfs use might make memory usage judgments more complicated.

But the only examples of swap messages are during devel/*-gcc based
buildworld attempts after 6.2.0 --and all of those have the issue.

So I'do some experiments with more RAM assigned and smaller -j <?>
numbers and see if that allows completion without the the SIGSEGV's
or new ERROR messages from ctfconvert.
Comment 19 Mark Millard 2016-12-20 21:46:44 UTC
(In reply to Mark Millard from comment #18)

The SIGSEGV problem happens without swap space problems being
involved.

I have verified that

cleanworld
kernel-toolchain
buildkernel

does not get the swap space reports but does get the notices:

Dec 20 13:41:35 FreeBSDx64 kernel: pid 82491 (ctfconvert), uid 0: exited on signal 11 (core dumped)
Dec 20 13:41:36 FreeBSDx64 kernel: pid 82493 (ctfconvert), uid 0: exited on signal 11 (core dumped)

It also gets the notices like:

ERROR: ctfconvert: die 23764: failed to get ref: No entry found [dwarf_attrval_unsigned(177)]
Comment 20 Mark Millard 2016-12-21 01:22:15 UTC
(In reply to Mark Millard from comment #18)

The following combination avoided the swap space problem and appeared
to not use swap (based on looking at a top -PCaopid display
periodically during buildworld)

RAM:  6 GByte (instead of 4 GByte)
-j 4          (instead of -j 5, still 4 cores)
swap: 2 GByte (unchanged)

It still stopped at:

--- all_subdir_lib/libdevdctl ---
/usr/local/bin/x86_64-freebsd-ld: /usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/world32/usr/src/lib/libc++/libc++.a(iostream.o): warning: relocation in readonly section `.eh_frame'
/usr/local/bin/x86_64-freebsd-ld: warning: creating a DT_TEXTREL in a shared object.
collect2: error: ld returned 1 exit status

as reported in bugzilla 215404.

(I used an amd64 -> amd64 test based on devel/amd64-gcc and devel/amd64-binutils .)

So it does not look like the swap space issue matters to what I've reported
in any of the bugzilla reports.
Comment 21 Baptiste Daroussin freebsd_committer freebsd_triage 2016-12-25 23:27:49 UTC
The DT_TEXTREL has been fixed, for cftconvert it is still an issue
Comment 22 Mark Millard 2016-12-26 11:23:10 UTC
(In reply to Baptiste Daroussin from comment #21)

I've tried buildworld based on devel/powerpc64-gcc (6.2.0 based) and with
lib32 for amd64 (6.2.0 based). Both completed and I've classified both as
closed-as-fixed. That does not change the status of this bugzilla report
(215350).

[I classically do not build lib32 for powerpc64 via gcc based compilers:

# powerpc64 LIB32 builds via gcc 4.9 or later variants that I've tried
# but the LIB32 does not work [crtbeginS code problem(s)]
WITHOUT_LIB32=

But I may go back and do a WITH_LIB32= build for powerpc64 for
completeness.
]
Comment 23 Mark Johnston freebsd_committer freebsd_triage 2016-12-27 01:26:33 UTC
The ctfconvert crashes seems to be the result of a libdwarf bug:
https://reviews.freebsd.org/D8920
Comment 24 Mark Millard 2016-12-27 06:52:22 UTC
(In reply to Mark Johnston from comment #23)

[Based on -r310556 of head and the usage of devel/amd64-gcc .]

I applied the patch and attempted cleanworld then buildworld buildkernel
and the patch changed the build behavior but the build still stopped for
another reason. Likely things are fixed for the ctfconvert issue(s) but
as yet I do not seem to be able to complete a full test.

The ERROR lines in the build's typescript log are as shown below.

# grep "\<ERROR" /root/sys_typescripts/typescript_make_amd64_nodebug_incl_clang_xtoolchain-amd64-host-2016-12-26:18:38:50
ERROR: ctfconvert: file does not contain dwarf type data (try compiling with -g)
ERROR: ctfconvert: rc = -1 No entry found [dwarf_next_cu_header_c(61)]
ERROR: ctfconvert: rc = -1 No entry found [dwarf_next_cu_header_c(61)]
ERROR: ctfconvert: file does not contain dwarf type data (try compiling with -g)
.ERROR_TARGET='ck_array.o'
.ERROR_META_FILE='/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG/ck_array.o.meta'
.ERROR_TARGET=''
.ERROR_META_FILE=''
.ERROR_TARGET='all_subdir_em'
.ERROR_META_FILE=''
.ERROR_TARGET=''
.ERROR_META_FILE=''
.ERROR_TARGET='all_subdir_drm2/radeonkms'
.ERROR_META_FILE=''
.ERROR_TARGET='all_subdir_drm2/radeonkms'
.ERROR_META_FILE=''
.ERROR_TARGET='all_subdir_drm2'
.ERROR_META_FILE=''
.ERROR_TARGET='all_subdir_drm2'
.ERROR_META_FILE=''
.ERROR_TARGET='modules-all'
.ERROR_META_FILE='/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG/ck_array.o.meta'
.ERROR_TARGET='modules-all'
.ERROR_META_FILE='/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG/ck_array.o.meta'
.ERROR_TARGET='buildkernel'
.ERROR_META_FILE=''
.ERROR_TARGET='buildkernel'
.ERROR_META_FILE=''
.ERROR_TARGET='buildkernel'
.ERROR_META_FILE=''
.ERROR_TARGET='buildkernel'
.ERROR_META_FILE=''



The failure that stopped the build was:

--- ck_array.o ---
In file included from /usr/src/sys/contrib/ck/include/ck_pr.h:39:0,
                 from /usr/src/sys/contrib/ck/include/ck_array.h:33,
                 from /usr/src/sys/contrib/ck/src/ck_array.c:28:
/usr/src/sys/contrib/ck/include/gcc/x86_64/ck_pr.h: In function 'ck_pr_fas_double':
/usr/src/sys/contrib/ck/include/gcc/x86_64/ck_pr.h:135:1: error: SSE register return with SSE disabled
 CK_PR_FAS_S(double, double, "xchgq")
 ^~~~~~~~~~~
*** [ck_array.o] Error code 1

make[2]: stopped in /usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG
.ERROR_TARGET='ck_array.o'
.ERROR_META_FILE='/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG/ck_array.o.meta'


which should at least give a clue how far it got.
Comment 25 Mark Johnston freebsd_committer freebsd_triage 2016-12-27 07:02:56 UTC
(In reply to Mark Millard from comment #24)
I hit that too. That's an error in ConcurrencyKit, which was imported recently. Nothing actually uses it yet, so for testing purposes it can be disabled by commenting out the lines starting with "contrib/ck/" in sys/conf/files.
Comment 26 Mark Millard 2016-12-27 07:42:23 UTC
(In reply to Mark Johnston from comment #25)

[I had already started a powerpc64 devel/powerpc64-gcc based build test.]

For powerpc64 I tried cleanworld then kernel-toolchain then buildkernel .
It also got farther than before your patch. But it stopped during
db_trace.o :


--- db_trace.o ---
/usr/src/sys/powerpc/powerpc/db_trace.c: In function 'db_trace_self':
/usr/src/sys/powerpc/powerpc/db_trace.c:299:20: error: calling '__builtin_frame_address' with a nonzero argument is unsafe [-Werror=frame-address]
  addr = (db_addr_t)__builtin_frame_address(1);
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~
. . .
--- db_trace.o ---
cc1: all warnings being treated as errors
*** [db_trace.o] Error code 1

make[2]: stopped in /usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG
.ERROR_TARGET='db_trace.o'
.ERROR_META_FILE='/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG/db_trace.o.meta'


So here I can not directly complete the test but things are improved.
Comment 27 Mark Millard 2016-12-27 07:52:12 UTC
(In reply to Mark Johnston from comment #23)

The way the  patch is structured I gather that either:

A) There is at most one of:
       DW_AT_abstract_origin
       vs.
       DW_AT_specification
   for a given die value.

vs.

B) If DW_AT_abstract_origin exists for a given
   die value then any DW_AT_specification is
   irrelevant --even if DW_AT_abstract_origin
   ends up leading to DWARF_SET_ERROR use and
   returning.
Comment 28 Mark Millard 2016-12-27 10:24:04 UTC
(In reply to Mark Johnston from comment #25)

'commenting out the lines starting with "contrib/ck/" in sys/conf/files'
for amd64 targeting:

It does not let me get farther but unless WERROR= is used buildkernel
later fails with the below. Using WERROR= does let it complete. [And
does for targeting powerpc64 as well.]

amd64 targeting without using WERROR= ends up with;

--- modules-all ---
In file included from /usr/src/sys/dev/hptmv/global.h:197:0,
                 from /usr/src/sys/modules/hptmv/../../dev/hptmv/mv.c:42:
/usr/src/sys/dev/hptmv/vdevice.h:145:2: error: variably modified '_ArrayTables' at file scope [-Werror]
  BYTE    _ArrayTables[MAX_ARRAY_PER_VBUS * ARRAY_VDEV_SIZE];
  ^~~~
cc1: all warnings being treated as errors
*** [mv.o] Error code 1

make[4]: stopped in /usr/src/sys/modules/hptmv
.ERROR_TARGET='mv.o'
.ERROR_META_FILE='/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG/modules/usr/src/sys/modules/hptmv/mv.o.meta'



# Meta data file /usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG/modules/usr/src/sys/modules/hptmv/mv.o.meta
CMD /usr/local/bin/x86_64-unknown-freebsd12.0-gcc -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 --sysroot=/usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/tmp -B/usr/local/x86_64-freebsd/bin/    -Werror -D_KERNEL -DKLD_MODULE -nostdinc   -DHAVE_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-pointer -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 -Wall -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=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=overflow -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  -v -finline-limit=8000 -fms-extensions --param inline-unit-growth=100 --param large-function-growth=1000  -std=iso9899:1999 -c /usr/src/sys/modules/hptmv/../../dev/hptmv/mv.c -o mv.o
CMD ctfconvert -L VERSION -g mv.o
CWD /usr/obj/amd64_xtoolchain/amd64.amd64/usr/src/sys/GENERIC-NODBG/modules/usr/src/sys/modules/hptmv
TARGET mv.o
-- command output --
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-zlib --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/' '-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-pointer' '-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' '-Wall' '-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=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=overflow' '-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' '-v' '-finline-limit=8000' '-fms-extensions' '--param' 'inline-unit-growth=100' '--param' 'large-function-growth=1000' '-std=c99' '-c' '-o' 'mv.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_OPTION_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/hptmv/../../dev/hptmv/mv.c -quiet -dumpbase mv.c -mno-omit-leaf-frame-pointer -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float -mtune=generic -march=x86-64 -auxbase-strip mv.o -g -gdwarf-2 -Werror -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-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=overflow -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-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 /tmp//ccR3U0ls.s
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
In file included from /usr/src/sys/dev/hptmv/global.h:197:0,
                 from /usr/src/sys/modules/hptmv/../../dev/hptmv/mv.c:42:
/usr/src/sys/dev/hptmv/vdevice.h:145:2: error: variably modified '_ArrayTables' at file scope [-Werror]
  BYTE    _ArrayTables[MAX_ARRAY_PER_VBUS * ARRAY_VDEV_SIZE];
  ^~~~
Comment 29 commit-hook freebsd_committer freebsd_triage 2016-12-28 21:55:28 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 30 Mark Millard 2016-12-30 08:30:15 UTC
(In reply to commit-hook from comment #29)

As of head -r310794 for /usr/src and -r429946 for /usr/ports
I no longer get any ctfconvert SIGSEGV issues.

This is true for both amd64 and powerpc64. 

I'll note that -r429946 is after devel/*-gcc switched to
being 6.3.0 based so this testing was based on 6.3.0 .

I assume that this should stay open until after the MFC.
Comment 31 commit-hook freebsd_committer freebsd_triage 2017-02-03 01:32:29 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
Comment 32 Eitan Adler freebsd_committer freebsd_triage 2018-05-28 19:44:28 UTC
batch change:

For bugs that match the following
-  Status Is In progress 
AND
- Untouched since 2018-01-01.
AND
- Affects Base System OR Documentation

DO:

Reset to open status.


Note:
I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.
Comment 33 Oleksandr Tymoshenko freebsd_committer freebsd_triage 2019-01-21 19:25:45 UTC
There is a commit referencing this PR, but it's still not closed and has been inactive for some time. Closing the PR as fixed but feel free to re-open it if the issue hasn't been completely resolved.

Thanks