From owner-p4-projects@FreeBSD.ORG Mon Apr 17 04:48:54 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4C91F16A406; Mon, 17 Apr 2006 04:48:54 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 133B616A400 for ; Mon, 17 Apr 2006 04:48:54 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id C984D43D45 for ; Mon, 17 Apr 2006 04:48:53 +0000 (GMT) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k3H4mrmE092278 for ; Mon, 17 Apr 2006 04:48:53 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k3H4mr1r092275 for perforce@freebsd.org; Mon, 17 Apr 2006 04:48:53 GMT (envelope-from jb@freebsd.org) Date: Mon, 17 Apr 2006 04:48:53 GMT Message-Id: <200604170448.k3H4mr1r092275@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 95414 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Apr 2006 04:48:54 -0000 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 +# 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