From d69cdb36aa7fa9e45aa4508448fc3fa1df12743d Mon Sep 17 00:00:00 2001 From: Richard Lowe Date: Sun, 23 Jun 2013 17:17:05 -0400 Subject: [PATCH] 3735 should include an empty make variable in the default CFLAGS/CCFLAGS 3844 the build should make source-level debugging easier Reviewed by: Robert Mustacchi Reviewed by: Garrett D'Amore Reviewed by: Gordon Ross Approved by: Gordon Ross --- usr/src/Makefile.master | 64 +++++++++++++++++++++++++-------- usr/src/cmd/Makefile.ctf | 2 +- usr/src/lib/Makefile.lib | 2 +- usr/src/uts/Makefile.uts | 2 ++ usr/src/uts/sparc/Makefile.sparc.shared | 2 ++ usr/src/uts/sun4u/Makefile.sun4u.shared | 2 ++ usr/src/uts/sun4v/Makefile.sun4v.shared | 3 ++ 7 files changed, 60 insertions(+), 17 deletions(-) diff --git a/usr/src/Makefile.master b/usr/src/Makefile.master index 3c48713e88..31e957dc6e 100644 --- a/usr/src/Makefile.master +++ b/usr/src/Makefile.master @@ -350,7 +350,7 @@ CCNOAUTOINLINE= -_gcc=-fno-inline-small-functions \ # Since we do some of this (foo might be referenced in common kernel code # but provided only for some cpu modules or platforms), we disable this # optimization. -# +# sparc_CCUNBOUND = -Wd,-xsafe=unboundsym i386_CCUNBOUND = CCUNBOUND = $($(MACH)_CCUNBOUND) @@ -397,7 +397,7 @@ ILDOFF= -xildoff XDEPEND= -xdepend XFFLAG= -xF=%all XESS= -xs -XSTRCONST= -xstrconst +XSTRCONST= -xstrconst # # turn warnings into errors (C) @@ -535,19 +535,46 @@ amd64_XREGSFLAG = XREGSFLAG = $($(MACH)_XREGSFLAG) XREGSFLAG64 = $($(MACH64)_XREGSFLAG) +# dmake SOURCEDEBUG=yes ... enables source-level debugging information, and +# avoids stripping it. +SOURCEDEBUG = $(POUND_SIGN) +SRCDBGBLD = $(SOURCEDEBUG:yes=) + +# +# These variables are intended ONLY for use by developers to safely pass extra +# flags to the compilers without unintentionally overriding Makefile-set +# flags. They should NEVER be set to any value in a Makefile. +# +# They come last in the associated FLAGS variable such that they can +# explicitly override things if necessary, there are gaps in this, but it's +# the best we can manage. +# +CUSERFLAGS = +CUSERFLAGS64 = $(CUSERFLAGS) +CCUSERFLAGS = +CCUSERFLAGS64 = $(CCUSERFLAGS) + +CSOURCEDEBUGFLAGS = +CCSOURCEDEBUGFLAGS = +$(SRCDBGBLD)CSOURCEDEBUGFLAGS = -g -xs +$(SRCDBGBLD)CCSOURCEDEBUGFLAGS = -g -xs + CFLAGS= $(COPTFLAG) $($(MACH)_CFLAGS) $(SPACEFLAG) $(CCMODE) \ $(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG) \ - $(CGLOBALSTATIC) $(CCNOAUTOINLINE) + $(CGLOBALSTATIC) $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \ + $(CUSERFLAGS) CFLAGS64= $(COPTFLAG64) $($(MACH64)_CFLAGS) $(SPACEFLAG64) $(CCMODE64) \ $(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG64) \ - $(CGLOBALSTATIC) $(CCNOAUTOINLINE) + $(CGLOBALSTATIC) $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \ + $(CUSERFLAGS64) # # Flags that are used to build parts of the code that are subsequently # run on the build machine (also known as the NATIVE_BUILD). # NATIVE_CFLAGS= $(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) $(CCMODE) \ $(ILDOFF) $(CERRWARN) $(C99MODE) $($(NATIVE_MACH)_CCUNBOUND) \ - $(IROPTFLAG) $(CGLOBALSTATIC) $(CCNOAUTOINLINE) + $(IROPTFLAG) $(CGLOBALSTATIC) $(CCNOAUTOINLINE) \ + $(CSOURCEDEBUGFLAGS) $(CUSERFLAGS) DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\" # For messaging. DTS_ERRNO=-D_TS_ERRNO @@ -565,7 +592,7 @@ JAVAFLAGS= -deprecation MSGROOT= $(ROOT)/catalog MSGDOMAIN= $(MSGROOT)/$(TEXT_DOMAIN) MSGDOMAINPOFILE = $(MSGDOMAIN)/$(POFILE) -DCMSGDOMAIN= $(MSGROOT)/LC_TIME/$(TEXT_DOMAIN) +DCMSGDOMAIN= $(MSGROOT)/LC_TIME/$(TEXT_DOMAIN) DCMSGDOMAINPOFILE = $(DCMSGDOMAIN)/$(DCFILE:.dc=.po) CLOBBERFILES += $(POFILE) $(POFILES) @@ -609,13 +636,15 @@ amd64_CCOPTFLAG= -O CCOPTFLAG= $($(MACH)_CCOPTFLAG) CCOPTFLAG64= $($(MACH64)_CCOPTFLAG) -CCFLAGS= $(CCOPTFLAG) $($(MACH)_CCFLAGS) -CCFLAGS64= $(CCOPTFLAG64) $($(MACH64)_CCFLAGS) +CCFLAGS= $(CCOPTFLAG) $($(MACH)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \ + $(CCUSERFLAGS) +CCFLAGS64= $(CCOPTFLAG64) $($(MACH64)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \ + $(CCUSERFLAGS64) # # # -ELFWRAP_FLAGS = +ELFWRAP_FLAGS = ELFWRAP_FLAGS64 = -64 # @@ -654,7 +683,7 @@ MAPFILE.NGB = $(MAPFILE.NGB_$(MACH)) # MAPFILE.INT = mapfile-intf -# +# # LDLIBS32 can be set in the environment to override the following assignment. # LDLIBS64 can be set to override the assignment made in Makefile.master.64. # These environment settings make sure that no libraries are searched outside @@ -887,12 +916,16 @@ AS_BIGPICFLAGS= $(C_BIGPICFLAGS) # Default label for CTF sections # CTFCVTFLAGS= -i -L VERSION +$(SRCDBGBLD)CTFCVTFLAGS += -g # -# Override to pass module-specific flags to ctfmerge. Currently used -# only by krtld to turn on fuzzy matching. +# Override to pass module-specific flags to ctfmerge. Currently used only by +# krtld to turn on fuzzy matching, and source-level debugging to inhibit +# stripping. # CTFMRGFLAGS= +$(SRCDBGBLD)CTFMRGFLAGS += -g + CTFCONVERT_O = $(CTFCONVERT) $(CTFCVTFLAGS) $@ @@ -975,6 +1008,7 @@ $(RELEASE_BUILD)PROCESS_COMMENT= @?${MCS} -d -a $(RELEASE_CM) STRIP_STABS= : $(RELEASE_BUILD)STRIP_STABS= $(STRIP) -x $@ +$(SRCDBGBLD)STRIP_STABS= : POST_PROCESS_O= $(PROCESS_COMMENT) $@ POST_PROCESS_A= @@ -1127,7 +1161,7 @@ CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN) .y.i: $(YACC) -d $< $(CPPFORPO) y.tab.c > $@ - $(RM) y.tab.c + $(RM) y.tab.c .l.i: $(LEX) $< @@ -1142,7 +1176,7 @@ CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN) $(YACC) -d $< $(CPPFORPO) y.tab.c > $<.i $(BUILD.po) - $(RM) y.tab.c + $(RM) y.tab.c .l.po: $(LEX) $< @@ -1166,5 +1200,5 @@ CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN) # # Include rules to render automated sccs get rules "safe". -# +# include $(SRC)/Makefile.noget diff --git a/usr/src/cmd/Makefile.ctf b/usr/src/cmd/Makefile.ctf index 8665fe237a..69521551ae 100644 --- a/usr/src/cmd/Makefile.ctf +++ b/usr/src/cmd/Makefile.ctf @@ -23,7 +23,7 @@ # Use is subject to license terms. # -POST_PROCESS += ; $(CTFMERGE) -L VERSION -o $@ $(OBJS) +POST_PROCESS += ; $(CTFMERGE) $(CTFMRGFLAGS) -L VERSION -o $@ $(OBJS) POST_PROCESS_O += ; $(CTFCONVERT_O) CFLAGS += $(CTF_FLAGS) diff --git a/usr/src/lib/Makefile.lib b/usr/src/lib/Makefile.lib index 8abc86c8f8..2ec26c5c8b 100644 --- a/usr/src/lib/Makefile.lib +++ b/usr/src/lib/Makefile.lib @@ -187,7 +187,7 @@ CTFMERGE_POST = : POST_PROCESS_O += ; $(CTFCONVERT_POST) POST_PROCESS_SO += ; $(CTFMERGE_POST) -CTFMERGE_LIB = $(CTFMERGE) -t -f -L VERSION -o $@ $(PICS) +CTFMERGE_LIB = $(CTFMERGE) $(CTFMRGFLAGS) -t -f -L VERSION -o $@ $(PICS) # conditional assignments diff --git a/usr/src/uts/Makefile.uts b/usr/src/uts/Makefile.uts index 64096234f0..c050cd45ff 100644 --- a/usr/src/uts/Makefile.uts +++ b/usr/src/uts/Makefile.uts @@ -236,6 +236,8 @@ CFLAGS_uts += $(CERRWARN) CFLAGS_uts += $(CCNOAUTOINLINE) CFLAGS_uts += $(CGLOBALSTATIC) CFLAGS_uts += $(EXTRA_CFLAGS) +CFLAGS_uts += $(CSOURCEDEBUGFLAGS) +CFLAGS_uts += $(CUSERFLAGS) # # Declare that $(OBJECTS) and $(LINTS) can be compiled in parallel. diff --git a/usr/src/uts/sparc/Makefile.sparc.shared b/usr/src/uts/sparc/Makefile.sparc.shared index cd8f6b9e4b..8af720cd34 100644 --- a/usr/src/uts/sparc/Makefile.sparc.shared +++ b/usr/src/uts/sparc/Makefile.sparc.shared @@ -141,6 +141,8 @@ CFLAGS += $(IROPTFLAG) CFLAGS += $(CGLOBALSTATIC) CFLAGS += -xregs=no%float CFLAGS += -xstrconst +CFLAGS += $(CSOURCEDEBUGFLAGS) +CFLAGS += $(CUSERFLAGS) ASFLAGS += $(XARCH) diff --git a/usr/src/uts/sun4u/Makefile.sun4u.shared b/usr/src/uts/sun4u/Makefile.sun4u.shared index 62101c9927..8675e7167f 100644 --- a/usr/src/uts/sun4u/Makefile.sun4u.shared +++ b/usr/src/uts/sun4u/Makefile.sun4u.shared @@ -215,6 +215,8 @@ CFLAGS += $(IROPTFLAG) CFLAGS += $(CGLOBALSTATIC) CFLAGS += -xregs=no%float CFLAGS += -xstrconst +CFLAGS += $(CSOURCEDEBUGFLAGS) +CFLAGS += $(CUSERFLAGS) ASFLAGS += $(AS_XARCH) diff --git a/usr/src/uts/sun4v/Makefile.sun4v.shared b/usr/src/uts/sun4v/Makefile.sun4v.shared index 23c4a9cff5..a0b12acb81 100644 --- a/usr/src/uts/sun4v/Makefile.sun4v.shared +++ b/usr/src/uts/sun4v/Makefile.sun4v.shared @@ -189,6 +189,9 @@ CFLAGS += $(IROPTFLAG) CFLAGS += $(CGLOBALSTATIC) CFLAGS += -xregs=no%float CFLAGS += -xstrconst +CFLAGS += $(CSOURCEDEBUGFLAGS) +CFLAGS += $(CUSERFLAGS) + CPPFLAGS += -DGLREG ASFLAGS += $(AS_XARCH) -DGLREG -- 2.11.4.GIT