Craig Mohrman wrote:
> >Roland Mainz wrote:
> >> Requesting sponsor for CR #6540117 ("Debug build of libc should be
> >> compiled with -xstrconst") ...
> >
> >Uhm... ping! Are there any volunteers for such a work ?
> 
> I'll take this.

_Thanks!_ ... :-)
... I've attached a prototype patch
("os_net_use_xstrconst_for_debug_libc_libnsl_libsocket_001.diff.txt")
which does the job for libc, libnsl and libsocket (I filed a seperate
RFE for libnsl+libsocket tonight).

I ran a couple of tests on x86 (including booting, shutdown, building
OS/Net, FireFox (and Mozilla/FireFox's automated test suite), CDE,
StarOffice and ksh93's test suite) and found no crashes (note that any
writes to string literals will result in a SIGSEGV (e.g. the states are
eiteh "working" xor "SIGSEGV" (unless an application does some fancy
stuff and traps this signal)), therefore any applications which depend
on such a thing will be easily detectable via looking at
/var/adm/messages if "coreadm" is enabled (e.g. (as "root") # mkdir
/var/core ; coreadm -g /var/core/core.%f.%p -e global -e process -e log
-e global-setid #) ... maybe we should write a heads-up and put that
information into that text...).

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) roland.mainz at nrubsig.org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 7950090
 (;O/ \/ \O;)
-------------- next part --------------
Index: src/lib/libsocket/Makefile.com
===================================================================
--- src/lib/libsocket/Makefile.com      (revision 694)
+++ src/lib/libsocket/Makefile.com      (working copy)
@@ -45,6 +45,12 @@
 LIBS =         $(DYNLIB) $(LINTLIB)
 
 SRCS =         $(INETOBJS:%.o=../inet/%.c) $(SOCKOBJS:%.o=../socket/%.c)
+
+# Make string literals read-only to save memory. Currently only done for debug
+# builds until the change had enough time to "bake" in the tree.
+$(NOT_RELEASE_BUILD)CFLAGS   += -xstrconst
+$(NOT_RELEASE_BUILD)CFLAGS64 += -xstrconst
+
 LDLIBS +=      -lnsl -lc
 
 SRCDIR =       ../common
Index: src/lib/libnsl/Makefile.com
===================================================================
--- src/lib/libnsl/Makefile.com (revision 694)
+++ src/lib/libnsl/Makefile.com (working copy)
@@ -200,6 +200,11 @@
 CCFLAGS += $(NOEXCEPTIONS)
 CCFLAGS64 += $(NOEXCEPTIONS)
 
+# Make string literals read-only to save memory. Currently only done for debug
+# builds until the change had enough time to "bake" in the tree.
+$(NOT_RELEASE_BUILD)CFLAGS   += -xstrconst
+$(NOT_RELEASE_BUILD)CFLAGS64 += -xstrconst
+
 CPPFLAGS +=    -I$(SRC)/lib/common/inc -I$(SRC)/lib/libnsl/include -D_REENTRANT
 CPPFLAGS +=    -I$(SRC)/lib/libnsl/dial
 
Index: src/lib/libc/sparcv9/Makefile
===================================================================
--- src/lib/libc/sparcv9/Makefile       (revision 702)
+++ src/lib/libc/sparcv9/Makefile       (working copy)
@@ -923,6 +923,10 @@
 
 CFLAGS64 += $(THREAD_DEBUG)
 
+# Make string literals read-only to save memory. Currently only done for debug
+# builds until the change had enough time to "bake" in the tree.
+$(NOT_RELEASE_BUILD)CFLAGS64 += -xstrconst
+
 ALTPICS= $(TRACEOBJS:%=pics/%)
 
 $(DYNLIB) := PICS += $(ROOTFS_LIBDIR64)/libc_i18n.a
Index: src/lib/libc/sparc/Makefile
===================================================================
--- src/lib/libc/sparc/Makefile (revision 694)
+++ src/lib/libc/sparc/Makefile (working copy)
@@ -979,6 +979,10 @@
 
 CFLAGS += $(THREAD_DEBUG)
 
+# Make string literals read-only to save memory. Currently only done for debug
+# builds until the change had enough time to "bake" in the tree.
+$(NOT_RELEASE_BUILD)CFLAGS += -xstrconst
+
 ALTPICS= $(TRACEOBJS:%=pics/%)
 
 $(DYNLIB) := PICS += $(ROOTFS_LIBDIR)/libc_i18n.a
Index: src/lib/libc/i386/Makefile.com
===================================================================
--- src/lib/libc/i386/Makefile.com      (revision 694)
+++ src/lib/libc/i386/Makefile.com      (working copy)
@@ -959,6 +959,10 @@
 
 CFLAGS += $(THREAD_DEBUG)
 
+# Make string literals read-only to save memory. Currently only done for debug
+# builds until the change had enough time to "bake" in the tree.
+$(NOT_RELEASE_BUILD)CFLAGS += -xstrconst
+
 ALTPICS= $(TRACEOBJS:%=pics/%)
 
 $(DYNLIB) := PICS += $(ROOTFS_LIBDIR)/libc_i18n.a
Index: src/lib/libc/amd64/Makefile
===================================================================
--- src/lib/libc/amd64/Makefile (revision 702)
+++ src/lib/libc/amd64/Makefile (working copy)
@@ -915,6 +915,10 @@
 
 CFLAGS64 += $(THREAD_DEBUG)
 
+# Make string literals read-only to save memory. Currently only done for debug
+# builds until the change had enough time to "bake" in the tree.
+$(NOT_RELEASE_BUILD)CFLAGS64 += -xstrconst
+
 ALTPICS= $(TRACEOBJS:%=pics/%)
 
 $(DYNLIB) := PICS += $(ROOTFS_LIBDIR64)/libc_i18n.a

Reply via email to