From owner-svn-src-projects@freebsd.org Tue Jun 27 06:02:52 2017 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06C06DA1C3F for ; Tue, 27 Jun 2017 06:02:52 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D1A107CF09; Tue, 27 Jun 2017 06:02:51 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5R62owA034766; Tue, 27 Jun 2017 06:02:50 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5R62oAH034765; Tue, 27 Jun 2017 06:02:50 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201706270602.v5R62oAH034765@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Tue, 27 Jun 2017 06:02:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r320396 - projects/runtime-coverage/share/mk X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jun 2017 06:02:52 -0000 Author: ngie Date: Tue Jun 27 06:02:50 2017 New Revision: 320396 URL: https://svnweb.freebsd.org/changeset/base/320396 Log: Stash work for adding runtime coverage support to bsd.lib.mk The initial work uses static libraries instead of dynamic libraries, for parity with pico-style libraries. I suspect this approach is slightly flawed, but I wanted to stash the WiP, just in case. Modified: projects/runtime-coverage/share/mk/bsd.lib.mk Modified: projects/runtime-coverage/share/mk/bsd.lib.mk ============================================================================== --- projects/runtime-coverage/share/mk/bsd.lib.mk Tue Jun 27 04:54:58 2017 (r320395) +++ projects/runtime-coverage/share/mk/bsd.lib.mk Tue Jun 27 06:02:50 2017 (r320396) @@ -76,9 +76,9 @@ CTFFLAGS+= -g .include -# prefer .s to a .c, add .po, remove stuff not used in the BSD libraries +# prefer .s to a .c, add .covo and .po, remove stuff not used in the BSD libraries # .pico used for PIC object files -.SUFFIXES: .out .o .bc .ll .po .pico .S .asm .s .c .cc .cpp .cxx .C .f .y .l .ln +.SUFFIXES: .out .o .bc .covo .ll .po .pico .S .asm .s .c .cc .cpp .cxx .C .f .y .l .ln .if !defined(PICFLAG) .if ${MACHINE_CPUARCH} == "sparc64" @@ -88,8 +88,14 @@ PICFLAG=-fpic .endif .endif +COV_FLAG=--coverage -g + PO_FLAG=-pg +.c.covo: + ${CC} ${COV_FLAG} ${STATIC_CFLAGS} ${COV_CFLAGS} -c ${.IMPSRC} -o ${.TARGET} + ${CTFCONVERT_CMD} + .c.po: ${CC} ${PO_FLAG} ${STATIC_CFLAGS} ${PO_CFLAGS} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} @@ -98,6 +104,9 @@ PO_FLAG=-pg ${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} +.cc.covo .C.covo .cpp.covo .cxx.covo: + ${CXX} ${COV_FLAG} ${STATIC_CXXFLAGS} ${COV_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} + .cc.po .C.po .cpp.po .cxx.po: ${CXX} ${PO_FLAG} ${STATIC_CXXFLAGS} ${PO_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} @@ -112,10 +121,15 @@ PO_FLAG=-pg ${FC} ${PICFLAG} -DPIC ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} ${CTFCONVERT_CMD} -.s.po .s.pico: +.s.covo .s.po .s.pico: ${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC} ${CTFCONVERT_CMD} +.asm.covo: + ${CC:N${CCACHE_BIN}} -x assembler-with-cpp -DCOV ${COV_CFLAGS} \ + ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} + ${CTFCONVERT_CMD} + .asm.po: ${CC:N${CCACHE_BIN}} -x assembler-with-cpp -DPROF ${PO_CFLAGS} \ ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} @@ -126,6 +140,11 @@ PO_FLAG=-pg ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} +.S.covo: + ${CC:N${CCACHE_BIN}} -DCOV ${COV_CFLAGS} ${ACFLAGS} -c ${.IMPSRC} \ + -o ${.TARGET} + ${CTFCONVERT_CMD} + .S.po: ${CC:N${CCACHE_BIN}} -DPROF ${PO_CFLAGS} ${ACFLAGS} -c ${.IMPSRC} \ -o ${.TARGET} @@ -184,6 +203,22 @@ lib${LIB_PRIVATE}${LIB}.a: ${OBJS} ${STATICOBJS} .endif .if !defined(INTERNALLIB) + +.if ${MK_COVERAGE} != "no" && defined(LIB) && !empty(LIB) +_LIBS+= lib${LIB_PRIVATE}${LIB}_c.a +COV_OBJS+= ${OBJS:.o=.covo} ${STATICOBJS:.o=.covo} +DEPENDOBJS+= ${COV_OBJS} +CLEANFILES+= ${COV_OBJS} +# XXX (ngie): tighten this down +CLEANFILES+= *.gcda *.gcno + +lib${LIB_PRIVATE}${LIB}_c.a: ${COV_OBJS} + @${ECHO} building coverage instrumented ${LIB} library + @rm -f ${.TARGET} + ${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' NMFLAGS='${NMFLAGS}' \ + ${LORDER} ${COV_OBJS} | ${TSORT} ${TSORTFLAGS}` ${ARADD} + ${RANLIB} ${RANLIBFLAGS} ${.TARGET} +.endif .if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB) _LIBS+= lib${LIB_PRIVATE}${LIB}_p.a