RFR: 8047952 : (s) Remove FORTIFY_SOURCE from fastdebug and slowdebug builds
Severin Gehwolf
sgehwolf at redhat.com
Tue Aug 12 10:04:22 UTC 2014
On Mon, 2014-08-11 at 16:09 -0700, Mike Duigou wrote:
> You are correct. The release and fastdebug need to be combined into one
> clause. I will fix this. Bash 4.0 doesn't appear to complain about the
> fallthrough but better to be compliant.
Correct me if I'm wrong, but aren't you only adjusting flags for
"slowdebug" builds? If so why do it with a case-construct rather than a
simple if? How about this?
diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4
--- a/common/autoconf/flags.m4
+++ b/common/autoconf/flags.m4
@@ -337,25 +337,15 @@
# bounds, memory and behavior checking options
if test "x$TOOLCHAIN_TYPE" = xgcc; then
- case $DEBUG_LEVEL in
- release )
- # no adjustment
- ;;
- fastdebug )
- # Add compile time bounds checks.
- CFLAGS_DEBUG_OPTIONS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1"
- CXXFLAGS_DEBUG_OPTIONS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1"
- ;;
- slowdebug )
- # Add runtime bounds checks and symbol info.
- CFLAGS_DEBUG_OPTIONS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
-fstack-protector-all --param ssp-buffer-size=1"
- CXXFLAGS_DEBUG_OPTIONS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
-fstack-protector-all --param ssp-buffer-size=1"
+ if test "x$DEBUG_LEVEL" = xslowdebug; then
+ # Add runtime stack smashing and undefined behavior checks
+ CFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param
ssp-buffer-size=1"
+ CXXFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param
ssp-buffer-size=1"
if test "x$HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR" = "xtrue"; then
CFLAGS_DEBUG_OPTIONS="$CFLAGS_DEBUG_OPTIONS
$CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG"
CXXFLAGS_DEBUG_OPTIONS="$CXXFLAGS_DEBUG_OPTIONS
$CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG"
fi
- ;;
- esac
+ fi
fi
AC_SUBST(CFLAGS_DEBUG_OPTIONS)
AC_SUBST(CXXFLAGS_DEBUG_OPTIONS)
A slowdebug build builds fine for me on Fedora 20 with this change to
your patch. Otherwise I'm seeing the configure error due to the wrong
bash snippet as Kim described.
Cheers,
Severin
> Mike
>
> On Aug 11 2014, at 15:05 , Kim Barrett <kim.barrett at oracle.com> wrote:
>
> > On Aug 8, 2014, at 8:23 PM, Mike Duigou <mike.duigou at oracle.com> wrote:
> >>
> >> Hello all;
> >>
> >> A previous version of this changeset was focused on disabling FORTIFY_SOURCE only for specific files with optimization disabled. This version entirely disables FORTIFY_SOURCE for all portions of the build. After additional problems; incompatibility of FORTIFY_SOURCE with -O0, lack of consistent support for FORTIFY_SOURCE in some distributions of glibc, etc. this seems like the best course. Should the separate issues with -Od be resolved then FORTIFY_SOURCE could be re-enabled selectively for specific platforms.
> >>
> >> webrev: http://cr.openjdk.java.net/~mduigou/JDK-8047952/1/webrev/
> >> jbsbug: https://bugs.openjdk.java.net/browse/JDK-8047952
> >>
> >> Mike
> >
> > In common/autoconf/flags.m4:
> >
> > 339 if test "x$TOOLCHAIN_TYPE" = xgcc; then
> > 340 case $DEBUG_LEVEL in
> > 341 release )
> > 342 fastdebug )
> > 343 # no adjustment
> > 344 ;;
> >
> > The bash documentation I'm looking at says each clause must end with
> > ";;", and makes no mention of any sort of fall-through from one clause
> > to the next.
> >
> > "... the ')' operator terminates a pattern list. A list of patterns
> > and an associated command-list is known as a clause. Each clause
> > must be terminated with ';;'"
> >
> > It's not clear from that description what should happen for line 341.
> >
>
More information about the hotspot-dev
mailing list