Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Aug 2017 23:30:25 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r322824 - in head: lib/clang share/mk usr.bin/clang
Message-ID:  <201708232330.v7NNUPpV052276@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Wed Aug 23 23:30:25 2017
New Revision: 322824
URL: https://svnweb.freebsd.org/changeset/base/322824

Log:
  Improve the coverage of debug symbols for MK_DEBUG_FILES.
  
  - Include debug symbols in static libraries.  This permits binaries
    to include debug symbols for functions obtained from static libraries.
  - Permit the C/C++ compiler flags added for MK_DEBUG_FILES to be
    overridden by setting DEBUG_FILES_CFLAGS.  Use this to limit the debug
    information for llvm libraries and binaries.
  
  Reviewed by:	emaste
  Sponsored by:	DARPA / AFRL
  Differential Revision:	https://reviews.freebsd.org/D12025

Added:
  head/lib/clang/Makefile.inc   (contents, props changed)
Modified:
  head/share/mk/bsd.lib.mk
  head/share/mk/bsd.prog.mk
  head/share/mk/bsd.sys.mk
  head/usr.bin/clang/Makefile.inc

Added: head/lib/clang/Makefile.inc
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/clang/Makefile.inc	Wed Aug 23 23:30:25 2017	(r322824)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+.include <bsd.compiler.mk>
+
+.if ${COMPILER_TYPE} == "clang"
+DEBUG_FILES_CFLAGS= -gline-tables-only
+.else
+DEBUG_FILES_CFLAGS= -g1
+.endif

Modified: head/share/mk/bsd.lib.mk
==============================================================================
--- head/share/mk/bsd.lib.mk	Wed Aug 23 21:49:56 2017	(r322823)
+++ head/share/mk/bsd.lib.mk	Wed Aug 23 23:30:25 2017	(r322824)
@@ -69,8 +69,8 @@ TAG_ARGS=	-T ${TAGS:[*]:S/ /,/g}
 
 .if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \
     empty(DEBUG_FLAGS:M-gdwarf*)
-SHARED_CFLAGS+= -g
-SHARED_CXXFLAGS+= -g
+CFLAGS+= ${DEBUG_FILES_CFLAGS}
+CXXFLAGS+= ${DEBUG_FILES_CFLAGS}
 CTFFLAGS+= -g
 .endif
 

Modified: head/share/mk/bsd.prog.mk
==============================================================================
--- head/share/mk/bsd.prog.mk	Wed Aug 23 21:49:56 2017	(r322823)
+++ head/share/mk/bsd.prog.mk	Wed Aug 23 23:30:25 2017	(r322824)
@@ -39,7 +39,7 @@ CFLAGS+=${CRUNCH_CFLAGS}
 .else
 .if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \
     empty(DEBUG_FLAGS:M-gdwarf-*)
-CFLAGS+= -g
+CFLAGS+= ${DEBUG_FILES_CFLAGS}
 CTFFLAGS+= -g
 .endif
 .endif

Modified: head/share/mk/bsd.sys.mk
==============================================================================
--- head/share/mk/bsd.sys.mk	Wed Aug 23 21:49:56 2017	(r322823)
+++ head/share/mk/bsd.sys.mk	Wed Aug 23 23:30:25 2017	(r322824)
@@ -212,6 +212,10 @@ SSP_CFLAGS?=	-fstack-protector
 CFLAGS+=	${SSP_CFLAGS}
 .endif # SSP && !ARM && !MIPS
 
+# Additional flags passed in CFLAGS and CXXFLAGS when MK_DEBUG_FILES is
+# enabled.
+DEBUG_FILES_CFLAGS?= -g
+
 # Allow user-specified additional warning flags, plus compiler and file
 # specific flag overrides, unless we've overriden this...
 .if ${MK_WARNS} != "no"

Modified: head/usr.bin/clang/Makefile.inc
==============================================================================
--- head/usr.bin/clang/Makefile.inc	Wed Aug 23 21:49:56 2017	(r322823)
+++ head/usr.bin/clang/Makefile.inc	Wed Aug 23 23:30:25 2017	(r322824)
@@ -2,4 +2,12 @@
 
 WARNS?=		0
 
+.include <bsd.compiler.mk>
+
+.if ${COMPILER_TYPE} == "clang"
+DEBUG_FILES_CFLAGS= -gline-tables-only
+.else
+DEBUG_FILES_CFLAGS= -g1
+.endif
+
 .include "../Makefile.inc"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708232330.v7NNUPpV052276>