From: Jarkko Hietaniemi <jhi@iki.fi>
Date: Sat, 12 Jan 2008 03:27:10 +0000 (+0200)
Subject: tru64: poison stack, write protect string constants
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1de7d430c3e295dfd482c700269ef72157f0fe82;p=p5sagit%2Fp5-mst-13.2.git

tru64: poison stack, write protect string constants
Message-Id: <200801120127.m0C1RAZ6088857@kosh.hut.fi>

p4raw-id: //depot/perl@32966
---

diff --git a/hints/dec_osf.sh b/hints/dec_osf.sh
index 4c18200..510537b 100644
--- a/hints/dec_osf.sh
+++ b/hints/dec_osf.sh
@@ -518,6 +518,27 @@ case "$LD_LIBRARY_PATH" in
 * ) export LD_LIBRARY_PATH ;;
 esac
 
+# Enforce strict data.
+case "$isgcc" in
+gcc)   ;;
+*)     # -trapuv poisons uninitialized stack with
+       #  0xfff58005fff58005 which is as a pointer a segmentation fault and
+       #  as a floating point a signaling NaN.  As integers/longs that causes
+       #  no traps but at least it is not zero.
+       # -readonly_strings moves string constants into read-only section
+       #  which hopefully means that modifying them leads into segmentation
+       #  faults.
+       #
+       for i in -trapuv -readonly_strings
+       do
+               case "$ccflags" in
+               *$i*) ;;
+               *) ccflags="$ccflags $i" ;;
+               esac
+       done
+       ;;
+esac
+
 #
 # Unset temporary variables no more needed.
 #