Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/share/mk fix code attempting to skip adding "-g" if "-g*" al...



details:   https://anonhg.NetBSD.org/src/rev/3dca66e79fbe
branches:  trunk
changeset: 373399:3dca66e79fbe
user:      mrg <mrg%NetBSD.org@localhost>
date:      Tue Feb 07 04:53:54 2023 +0000

description:
fix code attempting to skip adding "-g" if "-g*" already is used.

in bsd.lib.mk there's a check for "MKDEBUG != no" that will add
-g to CFLAGS (maybe) and to CSHLIBFLAGS (always), given that it
isn't in CFLAGS already.. except the conditional is "||" instead
of "&&" and since the MKDEBUG/NODEBUG checks pass, the CFLAGS
check isn't even performed.

additionally, check CXXFLAGS as well as CFLAGS.

this fixes the attempt to use "-g1" in the llvmrt build, which
fails because the compile lines end up being "... -g1 .. -g ..",
(the "-g" comes from the CSHLIBFLAGS variable in that case.)

this reduces the size of llvm-enabled gallium debug by ~1.5GiB
on amd64.

diffstat:

 share/mk/bsd.lib.mk |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (22 lines):

diff -r f2bc5298155c -r 3dca66e79fbe share/mk/bsd.lib.mk
--- a/share/mk/bsd.lib.mk       Tue Feb 07 04:46:00 2023 +0000
+++ b/share/mk/bsd.lib.mk       Tue Feb 07 04:53:54 2023 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.lib.mk,v 1.389 2022/03/29 22:48:04 christos Exp $
+#      $NetBSD: bsd.lib.mk,v 1.390 2023/02/07 04:53:54 mrg Exp $
 #      @(#)bsd.lib.mk  8.3 (Berkeley) 4/22/94
 
 .include <bsd.init.mk>
@@ -169,8 +169,10 @@
 MKSHLIBOBJS= no
 .endif
 
-.if (${MKDEBUG:Uno} != "no" && !defined(NODEBUG)) || \
-    (defined(CFLAGS) && !empty(CFLAGS:M*-g*))
+# Avoid adding "-g" if we already have a "-g*" option.
+.if (${MKDEBUG:Uno} != "no" && !defined(NODEBUG)) && \
+    (!defined(CFLAGS) || empty(CFLAGS:M-g*)) && \
+    (!defined(CXXFLAGS) || empty(CXXFLAGS:M-g*))
 # We only add -g to the shared library objects
 # because we don't currently split .a archives.
 CSHLIBFLAGS+=  -g



Home | Main Index | Thread Index | Old Index