From owner-freebsd-toolchain@FreeBSD.ORG Thu Feb 20 17:11:07 2014 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 845731B9 for ; Thu, 20 Feb 2014 17:11:07 +0000 (UTC) Received: from aslan.scsiguy.com (ns1.scsiguy.com [70.89.174.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 619FB1848 for ; Thu, 20 Feb 2014 17:11:06 +0000 (UTC) Received: from mollyrector-02.sldomain.com (207-225-98-3.dia.static.qwest.net [207.225.98.3]) (authenticated bits=0) by aslan.scsiguy.com (8.14.7/8.14.7) with ESMTP id s1KHACgX055545 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Thu, 20 Feb 2014 10:11:05 -0700 (MST) (envelope-from gibbs@freebsd.org) From: "Justin T. Gibbs" Content-Type: multipart/mixed; boundary="Apple-Mail=_E8F4FF85-F9F7-4544-A5F4-0A5E3B2ACCD2" Subject: ctfconvert broken for C++ objects? Message-Id: <216B816A-8ADA-438F-B834-8C386C5BC460@FreeBSD.org> Date: Wed, 19 Feb 2014 17:16:35 -0700 To: freebsd-toolchain@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) X-Mailer: Apple Mail (2.1827) X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Feb 2014 17:11:07 -0000 --Apple-Mail=_E8F4FF85-F9F7-4544-A5F4-0A5E3B2ACCD2 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 I noticed that ctfmerge was warning about missing CTF data when = compiling =93PROG_CXX=94 programs. I tracked this down to missing = ctfconvert calls when compiling C++ objects. Unfortunately, ctfconvert = segfaults in libdwarf on all of the C++ code I tried. Attached is a = quick hack to avoid the segfault, but I=92m hoping someone here with = more dwarf experience can point me in the right direction for a real = fix. Is this a known issue? I=92m testing this on a FreeBSD stable/9 from ~November of last year. Thanks, Justin --Apple-Mail=_E8F4FF85-F9F7-4544-A5F4-0A5E3B2ACCD2 Content-Disposition: attachment; filename=ctf_for_c++.diffs Content-Type: application/octet-stream; name="ctf_for_c++.diffs" Content-Transfer-Encoding: 7bit Change 1041767 by justing@justing_ns1_spectrabsd on 2014/02/17 10:41:25 Add CTF (required for DTrace) support for C++ programs. share/mk/bsd.lib.mk: share/mk/sys.mk: Add missing CTF convert calls to C++ -> object file transformation rules. Affected files ... ... //SpectraBSD/stable/share/mk/bsd.lib.mk#11 edit ... //SpectraBSD/stable/share/mk/sys.mk#8 edit Differences ... ==== //SpectraBSD/stable/share/mk/bsd.lib.mk#11 (text) ==== @@ -89,18 +89,27 @@ .cc.o .C.o .cpp.o .cxx.o: ${CXX} ${STATIC_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} + ${CTFCONVERT_CMD} -.cc.po .C.covo .cpp.covo .cxx.covo: +.cc.covo .C.covo .cpp.covo .cxx.covo: ${CXX} ${COVO_FLAG} ${STATIC_CXXFLAGS} ${COVO_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} + @[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \ + (${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \ + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}) .cc.po .C.po .cpp.po .cxx.po: ${CXX} ${PO_FLAG} ${STATIC_CXXFLAGS} ${PO_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} + ${CTFCONVERT_CMD} .cc.So .C.So .cpp.So .cxx.So: ${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} + ${CTFCONVERT_CMD} .cc.covSo .C.covSo .cpp.covSo .cxx.covSo: ${CXX} ${PICFLAG} ${COVO_FLAG} -DPIC ${SHARED_CXXFLAGS} ${CXXFLAGS} ${COVO_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} + @[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \ + (${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \ + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}) .f.covo: ${FC} ${COVO_FLAG} ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} ==== //SpectraBSD/stable/share/mk/sys.mk#8 (text) ==== @@ -233,9 +233,11 @@ .cc .cpp .cxx .C: ${CXX} ${CXXFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} + ${CTFCONVERT_CMD} .cc.o .cpp.o .cxx.o .C.o: ${CXX} ${CXXFLAGS} -c ${.IMPSRC} + ${CTFCONVERT_CMD} .m.o: ${OBJC} ${OBJCFLAGS} -c ${.IMPSRC} Change 1041820 by justing@justing_ns1_spectrabsd on 2014/02/17 11:42:29 Prevent ctfconvert segfault while processing certain C++ libraries. lib/libdwarf/dwarf_attrval.c: Don't segfault when an attribute lookup for an anonymous type fails. It looks like this failure may have been introduced in revision 662563 (SVN rev 248641) in FreeBSD. This change prevents the segfault, but doesn't address root cause. Upstream has moved to a new version of libdwarf/libelf, and we will update to that version first to see if the problem is still present, before debugging this further. Affected files ... ... //SpectraBSD/stable/lib/libdwarf/dwarf_attrval.c#3 edit Differences ... ==== //SpectraBSD/stable/lib/libdwarf/dwarf_attrval.c#3 (text) ==== @@ -243,6 +243,9 @@ DWARF_SET_ERROR(err, DWARF_E_BAD_FORM); ret = DWARF_E_BAD_FORM; } + } else { + DWARF_SET_ERROR(err, DWARF_E_BAD_FORM); + ret = DWARF_E_BAD_FORM; } if (ret == DWARF_E_NONE) { --Apple-Mail=_E8F4FF85-F9F7-4544-A5F4-0A5E3B2ACCD2--