git: c910570e7573 - main - Use compressed debug in standalone userland debug files by default
Ed Maste
emaste at FreeBSD.org
Wed Aug 4 20:10:36 UTC 2021
The branch main has been updated by emaste:
URL: https://cgit.FreeBSD.org/src/commit/?id=c910570e757305ba4a974b628bcd8fd4278908a7
commit c910570e757305ba4a974b628bcd8fd4278908a7
Author: Ed Maste <emaste at FreeBSD.org>
AuthorDate: 2021-03-01 17:25:22 +0000
Commit: Ed Maste <emaste at FreeBSD.org>
CommitDate: 2021-08-04 20:08:40 +0000
Use compressed debug in standalone userland debug files by default
The compiler supports CFLAGS=-gz=zlib to compress .debug sections in
object files, libraries, and binaries. Enable it to reduce disk usage
for standalone debug files (and /usr/obj).
Reviewed by: dim, kevans
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29002
---
share/mk/bsd.compiler.mk | 2 +-
share/mk/bsd.lib.mk | 5 +++++
share/mk/bsd.prog.mk | 4 ++++
share/mk/bsd.sys.mk | 2 +-
4 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/share/mk/bsd.compiler.mk b/share/mk/bsd.compiler.mk
index a52c3968fb09..681f6ffec14c 100644
--- a/share/mk/bsd.compiler.mk
+++ b/share/mk/bsd.compiler.mk
@@ -235,7 +235,7 @@ ${X_}COMPILER_FEATURES+= c++11 c++14
${X_}COMPILER_FEATURES+= c++17
.endif
.if ${${X_}COMPILER_TYPE} == "clang"
-${X_}COMPILER_FEATURES+= retpoline init-all
+${X_}COMPILER_FEATURES+= compressed-debug retpoline init-all
.endif
.if ${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 100000 || \
(${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 80100)
diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
index aaac0b68d984..0c80dd63d5e8 100644
--- a/share/mk/bsd.lib.mk
+++ b/share/mk/bsd.lib.mk
@@ -113,8 +113,13 @@ CXXFLAGS+= -ftrivial-auto-var-init=pattern
.if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \
empty(DEBUG_FLAGS:M-gdwarf*)
+.if !${COMPILER_FEATURES:Mcompressed-debug}
+CFLAGS+= ${DEBUG_FILES_CFLAGS:N-gz*}
+CXXFLAGS+= ${DEBUG_FILES_CFLAGS:N-gz*}
+.else
CFLAGS+= ${DEBUG_FILES_CFLAGS}
CXXFLAGS+= ${DEBUG_FILES_CFLAGS}
+.endif
CTFFLAGS+= -g
.endif
diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk
index 4f00be193874..437ccf373130 100644
--- a/share/mk/bsd.prog.mk
+++ b/share/mk/bsd.prog.mk
@@ -93,7 +93,11 @@ CFLAGS+=${CRUNCH_CFLAGS}
.else
.if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \
empty(DEBUG_FLAGS:M-gdwarf-*)
+.if !${COMPILER_FEATURES:Mcompressed-debug}
+CFLAGS+= ${DEBUG_FILES_CFLAGS:N-gz*}
+.else
CFLAGS+= ${DEBUG_FILES_CFLAGS}
+.endif
CTFFLAGS+= -g
.endif
.endif
diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk
index 031d49bbaca2..a964cf6e596c 100644
--- a/share/mk/bsd.sys.mk
+++ b/share/mk/bsd.sys.mk
@@ -247,7 +247,7 @@ CFLAGS+= ${SSP_CFLAGS}
# Additional flags passed in CFLAGS and CXXFLAGS when MK_DEBUG_FILES is
# enabled.
-DEBUG_FILES_CFLAGS?= -g
+DEBUG_FILES_CFLAGS?= -g -gz=zlib
# Allow user-specified additional warning flags, plus compiler and file
# specific flag overrides, unless we've overridden this...
More information about the dev-commits-src-all
mailing list