Date: Mon, 17 Apr 2006 04:48:53 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 95414 for review Message-ID: <200604170448.k3H4mr1r092275@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=95414 Change 95414 by jb@jb_freebsd2 on 2006/04/17 04:48:21 Add support to run ctfconvert on objects created. This uses the DEBUG_FLAGS definition to get the object created with debug info, even if DEBUG_FLAGS was not set. In the case that it wasn't set, ctfconvert will replace the debug info with CTF data. In the case where debug info is required, ctfconvert will add the CTF data, leaving the debug info in the file. This creates a bit of a loophole in the build process. Where CTF conversion is required, the DEBUG_FLAGS are altered on the assumption that ctfconvert will be run. If, as it turns out, a custom compilation rule is used in the makefile, and that rule doesn't have the call to ctfconvert coded, then the object is left with debug info in it when it wasn't intended. I guess we can regard this as just something we need to check before a release to ensure that all the objects we are building have appropriate ELF sections. This change only applies to built objects, not executables or shared libraries. Those require ctfmerge. Adding that to the build is next. One thing I haven't spent any time thinking about yet is the issue of cross-builds. I'll leave that for later. A LOT later! 8-) Affected files ... .. //depot/projects/dtrace/src/share/mk/bsd.lib.mk#2 edit .. //depot/projects/dtrace/src/share/mk/bsd.prog.mk#2 edit Differences ... ==== //depot/projects/dtrace/src/share/mk/bsd.lib.mk#2 (text+ko) ==== @@ -4,6 +4,18 @@ .include <bsd.init.mk> +# C Type Format data is required for DTrace +CTFFLAGS=-L VERSION + +.if !defined(NO_CTF) +CTFCONVERT?=ctfconvert +.if defined(DEBUG_FLAGS) +CTFFLAGS+=-g +.else +DEBUG_FLAGS=-g +.endif +.endif + # Set up the variables controlling shared libraries. After this section, # SHLIB_NAME will be defined only if we are to create a shared library. # SHLIB_LINK will be defined only if we are to create a link to it. @@ -59,43 +71,82 @@ .c.po: ${CC} ${PO_FLAG} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .c.So: ${CC} ${PICFLAG} -DPIC ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .cc.po .C.po .cpp.po .cxx.po: ${CXX} ${PO_FLAG} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .cc.So .C.So .cpp.So .cxx.So: ${CXX} ${PICFLAG} -DPIC ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .f.po: ${FC} -pg ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .f.So: ${FC} ${PICFLAG} -DPIC ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .m.po: ${OBJC} ${OBJCFLAGS} -pg -c ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .m.So: ${OBJC} ${PICFLAG} -DPIC ${OBJCFLAGS} -c ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .s.po .s.So: ${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .asm.po: ${CC} -x assembler-with-cpp -DPROF ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .asm.So: ${CC} -x assembler-with-cpp ${PICFLAG} -DPIC ${CFLAGS} \ -c ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .S.po: ${CC} -DPROF ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif .S.So: ${CC} ${PICFLAG} -DPIC ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif all: objwarn ==== //depot/projects/dtrace/src/share/mk/bsd.prog.mk#2 (text+ko) ==== @@ -10,6 +10,18 @@ CFLAGS+=${COPTS} .endif +# C Type Format data is required for DTrace +CTFFLAGS=-L VERSION + +.if !defined(NO_CTF) +CTFCONVERT?=ctfconvert +.if defined(DEBUG_FLAGS) +CTFFLAGS+=-g +.else +DEBUG_FLAGS=-g +.endif +.endif + .if defined(DEBUG_FLAGS) CFLAGS+=${DEBUG_FLAGS} .endif
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604170448.k3H4mr1r092275>