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
This commit is contained in:
John Baldwin 2017-08-23 23:30:25 +00:00
parent 21e10b16e0
commit de6feefdb7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=322824
5 changed files with 24 additions and 3 deletions

9
lib/clang/Makefile.inc Normal file
View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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"