Index: sys/conf/kern.pre.mk =================================================================== --- sys/conf/kern.pre.mk +++ sys/conf/kern.pre.mk @@ -114,6 +114,10 @@ # can override the others. CFLAGS+= ${CONF_CFLAGS} +.if ${LINKER_TYPE} != "binutils" || ${LINKER_VERSION} > 21750 +LDFLAGS+= -Wl,--build-id=sha1 +.endif + # Optional linting. This can be overridden in /etc/make.conf. LINTFLAGS= ${LINTOBJKERNFLAGS} Index: sys/conf/kmod.mk =================================================================== --- sys/conf/kmod.mk +++ sys/conf/kmod.mk @@ -125,6 +125,10 @@ CFLAGS+= -fno-common LDFLAGS+= -d -warn-common +.if ${LINKER_TYPE} != "binutils" || ${LINKER_VERSION} > 21750 +LDFLAGS+= -Wl,--build-id=sha1 +.endif + CFLAGS+= ${DEBUG_FLAGS} .if ${MACHINE_CPUARCH} == amd64 CFLAGS+= -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer