Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Sep 2019 14:07:13 -0000
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r346439 - stable/12/sys/conf
Message-ID:  <201904201105.x3KB5vTA090737@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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
 





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