Date: Wed, 19 Feb 2014 17:16:35 -0700 From: "Justin T. Gibbs" <gibbs@FreeBSD.org> To: freebsd-toolchain@freebsd.org Subject: ctfconvert broken for C++ objects? Message-ID: <216B816A-8ADA-438F-B834-8C386C5BC460@FreeBSD.org>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
I noticed that ctfmerge was warning about missing CTF data when compiling “PROG_CXX” 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’m hoping someone here with more dwarf experience can point me in the right direction for a real fix. Is this a known issue?
I’m testing this on a FreeBSD stable/9 from ~November of last year.
Thanks,
Justin
[-- Attachment #2 --]
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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?216B816A-8ADA-438F-B834-8C386C5BC460>
