svn commit: r346439 - stable/12/sys/conf

Mark Johnston markj at FreeBSD.org
Tue Sep 3 14:08:05 UTC 2019


Author: markj
Date: Sat Apr 20 11:05:56 2019
New Revision: 346439
URL: https://svnweb.freebsd.org/changeset/base/346439

Log:
  MFC r345348, r345594:
  Use -fdebug-prefix-map to map auto-generated kernel build paths.

Modified:
  stable/12/sys/conf/kern.post.mk
  stable/12/sys/conf/kmod.mk
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/conf/kern.post.mk
==============================================================================
--- stable/12/sys/conf/kern.post.mk	Sat Apr 20 11:04:13 2019	(r346438)
+++ stable/12/sys/conf/kern.post.mk	Sat Apr 20 11:05:56 2019	(r346439)
@@ -310,6 +310,11 @@ ${__obj}: ${OBJS_DEPEND_GUESS.${__obj}}
 
 .depend: .PRECIOUS ${SRCS}
 
+.if ${COMPILER_TYPE} == "clang" || \
+    (${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 60000)
+_MAP_DEBUG_PREFIX= yes
+.endif
+
 _ILINKS= machine
 .if ${MACHINE} != ${MACHINE_CPUARCH} && ${MACHINE} != "arm64"
 _ILINKS+= ${MACHINE_CPUARCH}
@@ -319,9 +324,17 @@ _ILINKS+= x86
 .endif
 
 # Ensure that the link exists without depending on it when it exists.
+# Ensure that debug info references the path in the source tree.
 .for _link in ${_ILINKS}
 .if !exists(${.OBJDIR}/${_link})
 ${SRCS} ${CLEAN:M*.o}: ${_link}
+.endif
+.if defined(_MAP_DEBUG_PREFIX)
+.if ${_link} == "machine"
+CFLAGS+= -fdebug-prefix-map=./machine=${SYSDIR}/${MACHINE}/include
+.else
+CFLAGS+= -fdebug-prefix-map=./${_link}=${SYSDIR}/${_link}/include
+.endif
 .endif
 .endfor
 

Modified: stable/12/sys/conf/kmod.mk
==============================================================================
--- stable/12/sys/conf/kmod.mk	Sat Apr 20 11:04:13 2019	(r346438)
+++ stable/12/sys/conf/kmod.mk	Sat Apr 20 11:05:56 2019	(r346439)
@@ -267,6 +267,11 @@ ${FULLPROG}: ${OBJS}
 	${OBJCOPY} --strip-debug ${.TARGET}
 .endif
 
+.if ${COMPILER_TYPE} == "clang" || \
+    (${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 60000)
+_MAP_DEBUG_PREFIX= yes
+.endif
+
 _ILINKS=machine
 .if ${MACHINE} != ${MACHINE_CPUARCH} && ${MACHINE} != "arm64"
 _ILINKS+=${MACHINE_CPUARCH}
@@ -283,9 +288,17 @@ beforebuild: ${_ILINKS}
 
 # Ensure that the links exist without depending on it when it exists which
 # causes all the modules to be rebuilt when the directory pointed to changes.
+# Ensure that debug info references the path in the source tree.
 .for _link in ${_ILINKS}
 .if !exists(${.OBJDIR}/${_link})
 OBJS_DEPEND_GUESS+=	${_link}
+.endif
+.if defined(_MAP_DEBUG_PREFIX)
+.if ${_link} == "machine"
+CFLAGS+= -fdebug-prefix-map=./machine=${SYSDIR}/${MACHINE}/include
+.else
+CFLAGS+= -fdebug-prefix-map=./${_link}=${SYSDIR}/${_link}/include
+.endif
 .endif
 .endfor
 




More information about the svn-src-all mailing list