1 #
  2 # Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4 #
  5 # This code is free software; you can redistribute it and/or modify it
  6 # under the terms of the GNU General Public License version 2 only, as
  7 # published by the Free Software Foundation.  Oracle designates this
  8 # particular file as subject to the "Classpath" exception as provided
  9 # by Oracle in the LICENSE file that accompanied this code.
 10 #
 11 # This code is distributed in the hope that it will be useful, but WITHOUT
 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14 # version 2 for more details (a copy is included in the LICENSE file that
 15 # accompanied this code).
 16 #
 17 # You should have received a copy of the GNU General Public License version
 18 # 2 along with this work; if not, write to the Free Software Foundation,
 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20 #
 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 22 # or visit www.oracle.com if you need additional information or have any
 23 # questions.
 24 #
 25 
 26 ################################################################################
 27 #
 28 # Setup flags for C/C++ compiler
 29 #
 30 
 31 ###############################################################################
 32 #
 33 # How to compile shared libraries.
 34 #
 35 AC_DEFUN([FLAGS_SETUP_SHARED_LIBS],
 36 [
 37   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 38     C_FLAG_REORDER=''
 39 
 40     # Default works for linux, might work on other platforms as well.
 41     SHARED_LIBRARY_FLAGS='-shared'
 42     SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1'
 43     SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
 44     SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
 45     SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
 46 
 47   elif test "x$TOOLCHAIN_TYPE" = xclang; then
 48     C_FLAG_REORDER=''
 49 
 50     if test "x$OPENJDK_TARGET_OS" = xmacosx; then
 51       # Linking is different on MacOSX
 52       SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0"
 53       SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path$(or [$]1,/.)'
 54       SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
 55       SET_SHARED_LIBRARY_NAME='-Wl,-install_name,@rpath/[$]1'
 56       SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,[$]1'
 57 
 58     else
 59       # Default works for linux, might work on other platforms as well.
 60       SHARED_LIBRARY_FLAGS='-shared'
 61       SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1'
 62       SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
 63       SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
 64 
 65       # arm specific settings
 66       if test "x$OPENJDK_TARGET_CPU" = "xarm"; then
 67         # '-Wl,-z,origin' isn't used on arm.
 68         SET_SHARED_LIBRARY_ORIGIN='-Wl,-rpath,\$$$$ORIGIN[$]1'
 69       else
 70         SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
 71       fi
 72     fi
 73 
 74   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 75     C_FLAG_REORDER='-xF'
 76     SHARED_LIBRARY_FLAGS="-G"
 77     SET_EXECUTABLE_ORIGIN='-R\$$ORIGIN[$]1'
 78     SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
 79     SET_SHARED_LIBRARY_NAME='-h [$]1'
 80     SET_SHARED_LIBRARY_MAPFILE='-M[$]1'
 81 
 82   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
 83     C_FLAG_REORDER=''
 84     SHARED_LIBRARY_FLAGS="-qmkshrobj -bM:SRE -bnoentry"
 85     SET_EXECUTABLE_ORIGIN=""
 86     SET_SHARED_LIBRARY_ORIGIN=''
 87     SET_SHARED_LIBRARY_NAME=''
 88     SET_SHARED_LIBRARY_MAPFILE=''
 89 
 90   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 91     C_FLAG_REORDER=''
 92     SHARED_LIBRARY_FLAGS="-dll"
 93     SET_EXECUTABLE_ORIGIN=''
 94     SET_SHARED_LIBRARY_ORIGIN=''
 95     SET_SHARED_LIBRARY_NAME=''
 96     SET_SHARED_LIBRARY_MAPFILE='-def:[$]1'
 97   fi
 98 
 99   AC_SUBST(C_FLAG_REORDER)
100   AC_SUBST(SET_EXECUTABLE_ORIGIN)
101   AC_SUBST(SET_SHARED_LIBRARY_ORIGIN)
102   AC_SUBST(SET_SHARED_LIBRARY_NAME)
103   AC_SUBST(SET_SHARED_LIBRARY_MAPFILE)
104   AC_SUBST(SHARED_LIBRARY_FLAGS)
105 ])
106 
107 AC_DEFUN([FLAGS_SETUP_DEBUG_SYMBOLS],
108 [
109   # Debug symbols
110   if test "x$TOOLCHAIN_TYPE" = xgcc; then
111     CFLAGS_DEBUG_SYMBOLS="-g"
112   elif test "x$TOOLCHAIN_TYPE" = xclang; then
113     CFLAGS_DEBUG_SYMBOLS="-g"
114   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
115     # -g0 enables debug symbols without disabling inlining.
116     CFLAGS_DEBUG_SYMBOLS="-g0 -xs"
117   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
118     CFLAGS_DEBUG_SYMBOLS="-g"
119   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
120     CFLAGS_DEBUG_SYMBOLS="-Z7 -d2Zi+"
121   fi
122 
123   AC_SUBST(CFLAGS_DEBUG_SYMBOLS)
124 ])
125 
126 AC_DEFUN([FLAGS_SETUP_WARNINGS],
127 [
128   AC_ARG_ENABLE([warnings-as-errors], [AS_HELP_STRING([--disable-warnings-as-errors],
129       [do not consider native warnings to be an error @<:@enabled@:>@])])
130 
131   AC_MSG_CHECKING([if native warnings are errors])
132   if test "x$enable_warnings_as_errors" = "xyes"; then
133     AC_MSG_RESULT([yes (explicitly set)])
134     WARNINGS_AS_ERRORS=true
135   elif test "x$enable_warnings_as_errors" = "xno"; then
136     AC_MSG_RESULT([no])
137     WARNINGS_AS_ERRORS=false
138   elif test "x$enable_warnings_as_errors" = "x"; then
139     AC_MSG_RESULT([yes (default)])
140     WARNINGS_AS_ERRORS=true
141   else
142     AC_MSG_ERROR([--enable-warnings-as-errors accepts no argument])
143   fi
144 
145   AC_SUBST(WARNINGS_AS_ERRORS)
146 
147   case "${TOOLCHAIN_TYPE}" in
148     microsoft)
149       DISABLE_WARNING_PREFIX="-wd"
150       CFLAGS_WARNINGS_ARE_ERRORS="-WX"
151       ;;
152     solstudio)
153       DISABLE_WARNING_PREFIX="-erroff="
154       CFLAGS_WARNINGS_ARE_ERRORS="-errtags -errwarn=%all"
155       ;;
156     gcc)
157       DISABLE_WARNING_PREFIX="-Wno-"
158       CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
159       # Repeate the check for the BUILD_CC and BUILD_CXX. Need to also reset
160       # CFLAGS since any target specific flags will likely not work with the
161       # build compiler
162       CC_OLD="$CC"
163       CXX_OLD="$CXX"
164       CC="$BUILD_CC"
165       CXX="$BUILD_CXX"
166       CFLAGS_OLD="$CFLAGS"
167       CFLAGS=""
168       BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-"
169       CC="$CC_OLD"
170       CXX="$CXX_OLD"
171       CFLAGS="$CFLAGS_OLD"
172       ;;
173     clang)
174       DISABLE_WARNING_PREFIX="-Wno-"
175       CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
176       ;;
177     xlc)
178       DISABLE_WARNING_PREFIX="-qsuppress="
179       CFLAGS_WARNINGS_ARE_ERRORS="-qhalt=w"
180       ;;
181   esac
182   AC_SUBST(DISABLE_WARNING_PREFIX)
183   AC_SUBST(BUILD_CC_DISABLE_WARNING_PREFIX)
184   AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS)
185 ])
186 
187 AC_DEFUN([FLAGS_SETUP_QUALITY_CHECKS],
188 [
189   # bounds, memory and behavior checking options
190   if test "x$TOOLCHAIN_TYPE" = xgcc; then
191     case $DEBUG_LEVEL in
192     release )
193       # no adjustment
194       ;;
195     fastdebug )
196       # no adjustment
197       ;;
198     slowdebug )
199       # FIXME: By adding this to C(XX)FLAGS_DEBUG_OPTIONS/JVM_CFLAGS_SYMBOLS it
200       # get's added conditionally on whether we produce debug symbols or not.
201       # This is most likely not really correct.
202 
203       # Add runtime stack smashing and undefined behavior checks.
204       CFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param ssp-buffer-size=1"
205       CXXFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param ssp-buffer-size=1"
206 
207       JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -fstack-protector-all --param ssp-buffer-size=1"
208       ;;
209     esac
210   fi
211 ])
212 
213 AC_DEFUN([FLAGS_SETUP_OPTIMIZATION],
214 [
215   if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
216     CC_HIGHEST="-fns -fsimple -fsingle -xbuiltin=%all -xdepend -xrestrict -xlibmil"
217 
218     C_O_FLAG_HIGHEST_JVM="-xO4"
219     C_O_FLAG_DEBUG_JVM=""
220     C_O_FLAG_SIZE=""
221     C_O_FLAG_DEBUG=""
222     C_O_FLAG_NONE=""
223     if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then
224       C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST"
225       C_O_FLAG_HI="-xO4 -Wu,-O4~yz"
226       C_O_FLAG_NORM="-xO2 -Wu,-O2~yz"
227     elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then
228       C_O_FLAG_HIGHEST="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0 \
229           -xprefetch=auto,explicit -xchip=ultra $CC_HIGHEST"
230       C_O_FLAG_HI="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0"
231       C_O_FLAG_NORM="-xO2 -Wc,-Qrm-s -Wc,-Qiselect-T0"
232     fi
233   elif test "x$TOOLCHAIN_TYPE" = xgcc; then
234     C_O_FLAG_HIGHEST_JVM="-O3"
235     C_O_FLAG_HIGHEST="-O3"
236     C_O_FLAG_HI="-O3"
237     C_O_FLAG_NORM="-O2"
238     C_O_FLAG_SIZE="-Os"
239     C_O_FLAG_DEBUG="-O0"
240     C_O_FLAG_DEBUG_JVM="-O0"
241     C_O_FLAG_NONE="-O0"
242   elif test "x$TOOLCHAIN_TYPE" = xclang; then
243     if test "x$OPENJDK_TARGET_OS" = xmacosx; then
244       # On MacOSX we optimize for size, something
245       # we should do for all platforms?
246       C_O_FLAG_HIGHEST_JVM="-Os"
247       C_O_FLAG_HIGHEST="-Os"
248       C_O_FLAG_HI="-Os"
249       C_O_FLAG_NORM="-Os"
250       C_O_FLAG_DEBUG_JVM=""
251     else
252       C_O_FLAG_HIGHEST_JVM="-O3"
253       C_O_FLAG_HIGHEST="-O3"
254       C_O_FLAG_HI="-O3"
255       C_O_FLAG_NORM="-O2"
256       C_O_FLAG_DEBUG_JVM="-O0"
257     fi
258     C_O_FLAG_SIZE="-Os"
259     C_O_FLAG_DEBUG="-O0"
260     C_O_FLAG_NONE="-O0"
261   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
262     C_O_FLAG_HIGHEST_JVM="-O3 -qhot=level=1 -qinline -qinlglue"
263     C_O_FLAG_HIGHEST="-O3 -qhot=level=1 -qinline -qinlglue"
264     C_O_FLAG_HI="-O3 -qinline -qinlglue"
265     C_O_FLAG_NORM="-O2"
266     C_O_FLAG_DEBUG="-qnoopt"
267     # FIXME: Value below not verified.
268     C_O_FLAG_DEBUG_JVM=""
269     C_O_FLAG_NONE="-qnoopt"
270   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
271     C_O_FLAG_HIGHEST_JVM="-O2 -Oy-"
272     C_O_FLAG_HIGHEST="-O2"
273     C_O_FLAG_HI="-O1"
274     C_O_FLAG_NORM="-O1"
275     C_O_FLAG_DEBUG="-Od"
276     C_O_FLAG_DEBUG_JVM=""
277     C_O_FLAG_NONE="-Od"
278     C_O_FLAG_SIZE="-Os"
279   fi
280 
281   # Now copy to C++ flags
282   CXX_O_FLAG_HIGHEST_JVM="$C_O_FLAG_HIGHEST_JVM"
283   CXX_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST"
284   CXX_O_FLAG_HI="$C_O_FLAG_HI"
285   CXX_O_FLAG_NORM="$C_O_FLAG_NORM"
286   CXX_O_FLAG_DEBUG="$C_O_FLAG_DEBUG"
287   CXX_O_FLAG_DEBUG_JVM="$C_O_FLAG_DEBUG_JVM"
288   CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
289   CXX_O_FLAG_SIZE="$C_O_FLAG_SIZE"
290 
291   if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
292     # In solstudio, also add this to C (but not C++) flags...
293     C_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST -xalias_level=basic"
294   fi
295 
296   # Adjust optimization flags according to debug level.
297   case $DEBUG_LEVEL in
298     release )
299       # no adjustment
300       ;;
301     fastdebug )
302       # Not quite so much optimization
303       C_O_FLAG_HI="$C_O_FLAG_NORM"
304       CXX_O_FLAG_HI="$CXX_O_FLAG_NORM"
305       ;;
306     slowdebug )
307       # Disable optimization
308       C_O_FLAG_HIGHEST_JVM="$C_O_FLAG_DEBUG_JVM"
309       C_O_FLAG_HIGHEST="$C_O_FLAG_DEBUG"
310       C_O_FLAG_HI="$C_O_FLAG_DEBUG"
311       C_O_FLAG_NORM="$C_O_FLAG_DEBUG"
312       C_O_FLAG_SIZE="$C_O_FLAG_DEBUG"
313       CXX_O_FLAG_HIGHEST_JVM="$CXX_O_FLAG_DEBUG_JVM"
314       CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_DEBUG"
315       CXX_O_FLAG_HI="$CXX_O_FLAG_DEBUG"
316       CXX_O_FLAG_NORM="$CXX_O_FLAG_DEBUG"
317       CXX_O_FLAG_SIZE="$CXX_O_FLAG_DEBUG"
318       ;;
319   esac
320 
321   AC_SUBST(C_O_FLAG_HIGHEST_JVM)
322   AC_SUBST(C_O_FLAG_HIGHEST)
323   AC_SUBST(C_O_FLAG_HI)
324   AC_SUBST(C_O_FLAG_NORM)
325   AC_SUBST(C_O_FLAG_NONE)
326   AC_SUBST(C_O_FLAG_SIZE)
327   AC_SUBST(CXX_O_FLAG_HIGHEST_JVM)
328   AC_SUBST(CXX_O_FLAG_HIGHEST)
329   AC_SUBST(CXX_O_FLAG_HI)
330   AC_SUBST(CXX_O_FLAG_NORM)
331   AC_SUBST(CXX_O_FLAG_NONE)
332   AC_SUBST(CXX_O_FLAG_SIZE)
333 ])
334 
335 AC_DEFUN([FLAGS_SETUP_CFLAGS],
336 [
337   ### CFLAGS
338 
339   FLAGS_SETUP_CFLAGS_HELPER
340 
341   FLAGS_OS=$OPENJDK_TARGET_OS
342   FLAGS_OS_TYPE=$OPENJDK_TARGET_OS_TYPE
343   FLAGS_CPU=$OPENJDK_TARGET_CPU
344   FLAGS_CPU_ARCH=$OPENJDK_TARGET_CPU_ARCH
345   FLAGS_CPU_BITS=$OPENJDK_TARGET_CPU_BITS
346   FLAGS_CPU_ENDIAN=$OPENJDK_TARGET_CPU_ENDIAN
347   FLAGS_CPU_LEGACY=$OPENJDK_TARGET_CPU_LEGACY
348   FLAGS_CPU_LEGACY_LIB=$OPENJDK_TARGET_CPU_LEGACY_LIB
349 
350   FLAGS_SETUP_CFLAGS_CPU_DEP([TARGET])
351 
352   FLAGS_OS=$OPENJDK_BUILD_OS
353   FLAGS_OS_TYPE=$OPENJDK_BUILD_OS_TYPE
354   FLAGS_CPU=$OPENJDK_BUILD_CPU
355   FLAGS_CPU_ARCH=$OPENJDK_BUILD_CPU_ARCH
356   FLAGS_CPU_BITS=$OPENJDK_BUILD_CPU_BITS
357   FLAGS_CPU_ENDIAN=$OPENJDK_BUILD_CPU_ENDIAN
358   FLAGS_CPU_LEGACY=$OPENJDK_BUILD_CPU_LEGACY
359   FLAGS_CPU_LEGACY_LIB=$OPENJDK_BUILD_CPU_LEGACY_LIB
360 
361   FLAGS_SETUP_CFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_])
362 
363   # Tests are only ever compiled for TARGET
364   CFLAGS_TESTLIB="$CFLAGS_JDKLIB"
365   CXXFLAGS_TESTLIB="$CXXFLAGS_JDKLIB"
366   CFLAGS_TESTEXE="$CFLAGS_JDKEXE"
367   CXXFLAGS_TESTEXE="$CXXFLAGS_JDKEXE"
368 
369   AC_SUBST(CFLAGS_TESTLIB)
370   AC_SUBST(CFLAGS_TESTEXE)
371   AC_SUBST(CXXFLAGS_TESTLIB)
372   AC_SUBST(CXXFLAGS_TESTEXE)
373 ])
374 
375 ################################################################################
376 # platform independent
377 AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
378 [
379   #### OS DEFINES, these should be independent on toolchain
380   if test "x$OPENJDK_TARGET_OS" = xlinux; then
381     CFLAGS_OS_DEF_JVM="-DLINUX"
382     CFLAGS_OS_DEF_JDK="-D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
383   elif test "x$OPENJDK_TARGET_OS" = xsolaris; then
384     CFLAGS_OS_DEF_JVM="-DSOLARIS"
385     CFLAGS_OS_DEF_JDK="-D__solaris__"
386   elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
387     CFLAGS_OS_DEF_JVM="-D_ALLBSD_SOURCE -D_DARWIN_C_SOURCE -D_XOPEN_SOURCE"
388     CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
389   elif test "x$OPENJDK_TARGET_OS" = xaix; then
390     CFLAGS_OS_DEF_JVM="-DAIX"
391   elif test "x$OPENJDK_TARGET_OS" = xbsd; then
392     CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE"
393   elif test "x$OPENJDK_TARGET_OS" = xwindows; then
394     CFLAGS_OS_DEF_JVM="-D_WINDOWS -DWIN32 -D_JNI_IMPLEMENTATION_"
395   fi
396 
397   # Setup target OS define. Use OS target name but in upper case.
398   OPENJDK_TARGET_OS_UPPERCASE=`$ECHO $OPENJDK_TARGET_OS | $TR 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
399   CFLAGS_OS_DEF_JDK="$CFLAGS_OS_DEF_JDK -D$OPENJDK_TARGET_OS_UPPERCASE"
400 
401   #### GLOBAL DEFINES
402   # Set some common defines. These works for all compilers, but assume
403   # -D is universally accepted.
404 
405   # Always enable optional macros for VM.
406   ALWAYS_CFLAGS_JVM="-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS"
407 
408   # Setup some hard coded includes
409   ALWAYS_CFLAGS_JDK=" \
410       -I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
411       -I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base/\$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
412       -I${TOPDIR}/src/java.base/share/native/libjava \
413       -I${TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/libjava \
414       -I${TOPDIR}/src/hotspot/share/include \
415       -I${TOPDIR}/src/hotspot/os/${HOTSPOT_TARGET_OS_TYPE}/include"
416 
417   ###############################################################################
418 
419   # Adjust flags according to debug level.
420   # Setup debug/release defines
421   if test "x$DEBUG_LEVEL" = xrelease; then
422     DEBUG_CFLAGS_JDK="-DNDEBUG"
423     if test "x$OPENJDK_TARGET_OS" = xsolaris; then
424       DEBUG_CFLAGS_JDK="$DEBUG_CFLAGS_JDK -DTRIMMED"
425     fi
426   else
427     DEBUG_CFLAGS_JDK="-DDEBUG"
428 
429     if test "x$TOOLCHAIN_TYPE" = xxlc; then
430       # We need '-qminimaltoc' or '-qpic=large -bbigtoc' if the TOC overflows.
431       # Hotspot now overflows its 64K TOC (currently only for debug),
432       # so for debug we build with '-qpic=large -bbigtoc'.
433       DEBUG_CFLAGS_JVM="-qpic=large"
434     fi
435   fi
436 
437   if test "x$DEBUG_LEVEL" != xrelease; then
438     DEBUG_OPTIONS_FLAGS_JDK="$CFLAGS_DEBUG_OPTIONS"
439     DEBUG_SYMBOLS_CFLAGS_JDK="$CFLAGS_DEBUG_SYMBOLS"
440   fi
441 
442   #### TOOLCHAIN DEFINES
443 
444   if test "x$TOOLCHAIN_TYPE" = xgcc; then
445     ALWAYS_DEFINES_JVM="-D_GNU_SOURCE -D_REENTRANT"
446   elif test "x$TOOLCHAIN_TYPE" = xclang; then
447     ALWAYS_DEFINES_JVM="-D_GNU_SOURCE"
448   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
449     ALWAYS_DEFINES_JVM="-DSPARC_WORKS -D_Crun_inline_placement"
450     ALWAYS_DEFINES_JDK="-DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
451     ALWAYS_DEFINES_JDK_CXXONLY="-DCC_NOEX"
452   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
453     ALWAYS_DEFINES_JVM="-D_REENTRANT"
454     ALWAYS_DEFINES_JDK="-D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
455   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
456     ALWAYS_DEFINES_JDK="-DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE \
457         -D_CRT_NONSTDC_NO_DEPRECATE -DWIN32 -DIAL"
458     ALWAYS_DEFINES_JVM="-DNOMINMAX"
459   fi
460 
461   ###############################################################################
462   #
463   #
464   # CFLAGS BASIC
465   if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
466     # COMMON to gcc and clang
467     TOOLCHAIN_CFLAGS_JVM="-pipe -fno-rtti -fno-exceptions \
468         -fvisibility=hidden -fno-strict-aliasing -fno-omit-frame-pointer"
469   fi
470 
471   if test "x$TOOLCHAIN_TYPE" = xgcc; then
472     TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -fcheck-new"
473     TOOLCHAIN_CFLAGS_JDK="-pipe"
474     TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX (but since this gives *worse* performance, use no-strict-aliasing everywhere!)
475 
476     CXXSTD_CXXFLAG="-std=gnu++98"
477     FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$CXXSTD_CXXFLAG -Werror],
478     						 IF_FALSE: [CXXSTD_CXXFLAG=""])
479     TOOLCHAIN_CFLAGS_JDK_CXXONLY="$CXXSTD_CXXFLAG"
480     TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM $CXXSTD_CXXFLAG"
481     ADLC_CXXFLAG="$CXXSTD_CXXFLAG"
482 
483 
484   elif test "x$TOOLCHAIN_TYPE" = xclang; then
485     # Restrict the debug information created by Clang to avoid
486     # too big object files and speed the build up a little bit
487     # (see http://llvm.org/bugs/show_bug.cgi?id=7554)
488     TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -flimit-debug-info"
489 
490     if test "x$OPENJDK_TARGET_OS" = xlinux; then
491       TOOLCHAIN_CFLAGS_JDK="-pipe"
492       TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX
493     fi
494   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
495     TOOLCHAIN_CFLAGS_JDK="-mt"
496     TOOLCHAIN_CFLAGS_JDK_CONLY="-xc99=%none -xCC -Xa -v -W0,-noglobal" # C only
497     TOOLCHAIN_CFLAGS_JDK_CXXONLY="-features=no%except -norunpath -xnolib" # CXX only
498     TOOLCHAIN_CFLAGS_JVM="-template=no%extdef -features=no%split_init \
499         -library=stlport4 -mt -features=no%except"
500     if test "x$DEBUG_LEVEL" = xslowdebug; then
501       # Previously -g was used instead of -g0 for slowdebug; this is equivalent
502       # to setting +d.
503       TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM +d"
504     fi
505 
506   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
507     TOOLCHAIN_CFLAGS_JDK="-qchars=signed -qfullpath -qsaveopt"  # add on both CFLAGS
508     TOOLCHAIN_CFLAGS_JVM="-qtune=balanced \
509         -qalias=noansi -qstrict -qtls=default -qlanglvl=c99vla \
510         -qlanglvl=noredefmac -qnortti -qnoeh -qignerrno"
511   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
512     TOOLCHAIN_CFLAGS_JVM="-nologo -MD -MP"
513     TOOLCHAIN_CFLAGS_JDK="-nologo -MD -Zc:wchar_t-"
514   fi
515 
516   # CFLAGS WARNINGS STUFF
517   # Set JVM_CFLAGS warning handling
518   if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
519     # COMMON to gcc and clang
520     WARNING_CFLAGS_JVM="-Wpointer-arith -Wsign-compare -Wunused-function"
521     if ! HOTSPOT_CHECK_JVM_VARIANT(zero); then
522       # Non-zero builds have stricter warnings
523       WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wundef -Wformat=2"
524     fi
525 
526   fi
527   if test "x$TOOLCHAIN_TYPE" = xgcc; then
528     WARNING_CFLAGS_JDK="-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2"
529     WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wunused-value -Woverloaded-virtual"
530 
531     if ! HOTSPOT_CHECK_JVM_VARIANT(zero); then
532       # Non-zero builds have stricter warnings
533       WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wreturn-type"
534     fi
535   elif test "x$TOOLCHAIN_TYPE" = xclang; then
536     WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wno-deprecated"
537     if test "x$OPENJDK_TARGET_OS" = xlinux; then
538       WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wno-sometimes-uninitialized"
539       WARNING_CFLAGS_JDK="-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2"
540     fi
541   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
542     WARNING_CFLAGS_JDK_CONLY="-errshort=tags"
543     WARNING_CFLAGS_JDK_CXXONLY="+w"
544     WARNING_CFLAGS_JDK="-errtags=yes -errfmt"
545   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
546     WARNING_CFLAGS="-W3"
547     WARNING_CFLAGS_JDK="-wd4800"
548   fi
549 
550   # Set some additional per-OS defines.
551 
552   # Additional macosx handling
553   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
554     OS_CFLAGS="-DMAC_OS_X_VERSION_MIN_REQUIRED=$MACOSX_VERSION_MIN_NODOTS \
555         -mmacosx-version-min=$MACOSX_VERSION_MIN"
556 
557     if test -n "$MACOSX_VERSION_MAX"; then
558         OS_CFLAGS="$OS_CFLAGS \
559             -DMAC_OS_X_VERSION_MAX_ALLOWED=$MACOSX_VERSION_MAX_NODOTS"
560     fi
561   fi
562 
563   # Where does this really belong??
564   if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
565     PICFLAG="-fPIC"
566   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
567     PICFLAG="-KPIC"
568   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
569     # '-qpic' defaults to 'qpic=small'. This means that the compiler generates only
570     # one instruction for accessing the TOC. If the TOC grows larger than 64K, the linker
571     # will have to patch this single instruction with a call to some out-of-order code which
572     # does the load from the TOC. This is of course slow. But in that case we also would have
573     # to use '-bbigtoc' for linking anyway so we could also change the PICFLAG to 'qpic=large'.
574     # With 'qpic=large' the compiler will by default generate a two-instruction sequence which
575     # can be patched directly by the linker and does not require a jump to out-of-order code.
576     # Another alternative instead of using 'qpic=large -bbigtoc' may be to use '-qminimaltoc'
577     # instead. This creates a distinct TOC for every compilation unit (and thus requires two
578     # loads for accessing a global variable). But there are rumors that this may be seen as a
579     # 'performance feature' because of improved code locality of the symbols used in a
580     # compilation unit.
581     PICFLAG="-qpic"
582   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
583     PICFLAG=""
584   fi
585 
586   JVM_PICFLAG="$PICFLAG"
587   JDK_PICFLAG="$PICFLAG"
588 
589   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
590     # Linking is different on MacOSX
591     JDK_PICFLAG=''
592     if test "x$STATIC_BUILD" = xtrue; then
593       JVM_PICFLAG=""
594     fi
595   fi
596 
597   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
598     OS_CFLAGS_JVM="$OS_CFLAGS_JVM -mno-omit-leaf-frame-pointer -mstack-alignment=16"
599   fi
600 
601   # Optional POSIX functionality needed by the JVM
602   #
603   # Check if clock_gettime is available and in which library. This indicates
604   # availability of CLOCK_MONOTONIC for hotspot. But we don't need to link, so
605   # don't let it update LIBS.
606   save_LIBS="$LIBS"
607   AC_SEARCH_LIBS(clock_gettime, rt, [HAS_CLOCK_GETTIME=true], [])
608   if test "x$LIBS" = "x-lrt "; then
609     CLOCK_GETTIME_IN_LIBRT=true
610   fi
611   LIBS="$save_LIBS"
612 
613   if test "x$HAS_CLOCK_GETTIME" = "xtrue"; then
614     OS_CFLAGS_JVM="$OS_CFLAGS_JVM -DSUPPORTS_CLOCK_MONOTONIC"
615     if test "x$CLOCK_GETTIME_IN_LIBRT" = "xtrue"; then
616       OS_CFLAGS_JVM="$OS_CFLAGS_JVM -DNEEDS_LIBRT"
617     fi
618   fi
619 
620   # EXPORT
621   AC_SUBST(ADLC_CXXFLAG)
622 ])
623 
624 ################################################################################
625 # $1 - Either BUILD or TARGET to pick the correct OS/CPU variables to check
626 #      conditionals against.
627 # $2 - Optional prefix for each variable defined.
628 AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
629 [
630   #### CPU DEFINES, these should (in theory) be independent on toolchain
631 
632   # Setup target CPU
633   # Setup endianness
634   if test "x$FLAGS_CPU_ENDIAN" = xlittle; then
635     $1_DEFINES_CPU_JVM="-DVM_LITTLE_ENDIAN"
636   fi
637   if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
638     # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the
639     #   Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
640     if test "x$FLAGS_CPU_ENDIAN" = xlittle; then
641       $1_DEFINES_CPU_JDK="-D_LITTLE_ENDIAN="
642     else
643       $1_DEFINES_CPU_JDK="-D_BIG_ENDIAN="
644     fi
645   else
646     if test "x$FLAGS_CPU_ENDIAN" = xlittle; then
647       $1_DEFINES_CPU_JDK="-D_LITTLE_ENDIAN"
648     else
649       $1_DEFINES_CPU_JDK="-D_BIG_ENDIAN"
650     fi
651   fi
652 
653   # setup CPU bit size
654   $1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -DARCH='\"$FLAGS_CPU_LEGACY\"' \
655       -D$FLAGS_CPU_LEGACY"
656 
657   if test "x$FLAGS_CPU_BITS" = x64; then
658     # -D_LP64=1 is only set on linux and mac. Setting on windows causes diff in
659     # unpack200.exe.
660     if test "x$FLAGS_OS" = xlinux || test "x$FLAGS_OS" = xmacosx; then
661       $1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_LP64=1"
662     fi
663     if test "x$FLAGS_OS" != xsolaris && test "x$FLAGS_OS" != xaix; then
664       # Solaris does not have _LP64=1 in the old build.
665       # xlc on AIX defines _LP64=1 by default and issues a warning if we redefine it.
666       $1_DEFINES_CPU_JVM="${$1_DEFINES_CPU_JVM} -D_LP64=1"
667     fi
668   fi
669 
670   # toolchain dependend, per-cpu
671   if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
672     if test "x$FLAGS_CPU_ARCH" = xx86; then
673       $1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -DcpuIntel -Di586 -D$FLAGS_CPU_LEGACY_LIB"
674     fi
675   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
676     if test "x$FLAGS_CPU" = xx86_64; then
677       $1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_AMD64_ -Damd64"
678     else
679       $1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_X86_ -Dx86"
680     fi
681   fi
682 
683   # CFLAGS PER CPU
684   if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
685     # COMMON to gcc and clang
686     if test "x$FLAGS_CPU" = xx86; then
687       # Force compatibility with i586 on 32 bit intel platforms.
688       $1_CFLAGS_CPU="-march=i586"
689     fi
690   fi
691 
692   if test "x$TOOLCHAIN_TYPE" = xgcc; then
693     if test "x$FLAGS_CPU" = xarm; then
694       # -Wno-psabi to get rid of annoying "note: the mangling of 'va_list' has changed in GCC 4.4"
695       $1_CFLAGS_CPU="-fsigned-char -Wno-psabi $ARM_ARCH_TYPE_FLAGS $ARM_FLOAT_TYPE_FLAGS -DJDK_ARCH_ABI_PROP_NAME='\"\$(JDK_ARCH_ABI_PROP_NAME)\"'"
696       $1_CFLAGS_CPU_JVM="-DARM"
697     elif test "x$FLAGS_CPU" = xaarch64; then
698       if test "x$HOTSPOT_TARGET_CPU_PORT" = xarm64; then
699         $1_CFLAGS_CPU_JVM="-fsigned-char -DARM"
700       fi
701     elif test "x$FLAGS_CPU_ARCH" = xppc; then
702       $1_CFLAGS_CPU_JVM="-minsert-sched-nops=regroup_exact -mno-multiple -mno-string"
703       if test "x$FLAGS_CPU" = xppc64; then
704         # -mminimal-toc fixes `relocation truncated to fit' error for gcc 4.1.
705         # Use ppc64 instructions, but schedule for power5
706         $1_CFLAGS_CPU_JVM="${$1_CFLAGS_CPU_JVM} -mminimal-toc -mcpu=powerpc64 -mtune=power5"
707       elif test "x$FLAGS_CPU" = xppc64le; then
708         # Little endian machine uses ELFv2 ABI.
709         # Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI.
710         $1_CFLAGS_CPU_JVM="${$1_CFLAGS_CPU_JVM} -DABI_ELFv2 -mcpu=power8 -mtune=power8"
711       fi
712     elif test "x$FLAGS_CPU" = xs390x; then
713       $1_CFLAGS_CPU="-mbackchain -march=z10"
714     fi
715 
716     if test "x$FLAGS_CPU_ARCH" != xarm &&  test "x$FLAGS_CPU_ARCH" != xppc; then
717       # for all archs except arm and ppc, prevent gcc to omit frame pointer
718       $1_CFLAGS_CPU_JDK="${$1_CFLAGS_CPU_JDK} -fno-omit-frame-pointer"
719     fi
720 
721   elif test "x$TOOLCHAIN_TYPE" = xclang; then
722     if test "x$FLAGS_OS" = xlinux; then
723       # ppc test not really needed for clang
724       if test "x$FLAGS_CPU_ARCH" != xarm &&  test "x$FLAGS_CPU_ARCH" != xppc; then
725         # for all archs except arm and ppc, prevent gcc to omit frame pointer
726         $1_CFLAGS_CPU_JDK="${$1_CFLAGS_CPU_JDK} -fno-omit-frame-pointer"
727       fi
728     fi
729 
730   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
731     if test "x$FLAGS_CPU" = xx86_64; then
732       # NOTE: -xregs=no%frameptr is supposed to be default on x64
733       $1_CFLAGS_CPU_JDK="-xregs=no%frameptr"
734     elif test "x$FLAGS_CPU" = xsparcv9; then
735       $1_CFLAGS_CPU_JVM="-xarch=sparc"
736       $1_CFLAGS_CPU_JDK_LIBONLY="-xregs=no%appl"
737     fi
738 
739   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
740     if test "x$FLAGS_CPU" = xppc64; then
741       $1_CFLAGS_CPU_JVM="-qarch=ppc64"
742     fi
743 
744   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
745     if test "x$FLAGS_CPU" = xx86; then
746       $1_CFLAGS_CPU_JVM="-arch:IA32"
747     elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then
748       if test "x$DEBUG_LEVEL" != xrelease; then
749         # NOTE: This is probably redundant; -homeparams is default on
750         # non-release builds.
751         $1_CFLAGS_CPU_JVM="-homeparams"
752       fi
753     fi
754   fi
755 
756   if test "x$TOOLCHAIN_TYPE" = xgcc; then
757     TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: 6, PREFIX: $2, IF_AT_LEAST: FLAGS_SETUP_GCC6_COMPILER_FLAGS($1))
758     $1_TOOLCHAIN_CFLAGS="${$1_GCC6_CFLAGS}"
759 
760     $1_WARNING_CFLAGS_JVM="-Wno-format-zero-length -Wtype-limits -Wuninitialized"
761   fi
762 
763   # EXPORT to API
764   CFLAGS_JVM_COMMON="$ALWAYS_CFLAGS_JVM $ALWAYS_DEFINES_JVM $TOOLCHAIN_CFLAGS_JVM \
765       $OS_CFLAGS $OS_CFLAGS_JVM $CFLAGS_OS_DEF_JVM $DEBUG_CFLAGS_JVM \
766       $WARNING_CFLAGS $WARNING_CFLAGS_JVM $JVM_PICFLAG"
767 
768   CFLAGS_JDK_COMMON="$ALWAYS_CFLAGS_JDK $ALWAYS_DEFINES_JDK $TOOLCHAIN_CFLAGS_JDK \
769       $OS_CFLAGS $CFLAGS_OS_DEF_JDK $DEBUG_CFLAGS_JDK $DEBUG_OPTIONS_FLAGS_JDK \
770       $WARNING_CFLAGS $WARNING_CFLAGS_JDK $DEBUG_SYMBOLS_CFLAGS_JDK"
771 
772   # Use ${$2EXTRA_CFLAGS} to block EXTRA_CFLAGS to be added to build flags.
773   # (Currently we don't have any OPENJDK_BUILD_EXTRA_CFLAGS, but that might
774   # change in the future.)
775 
776   CFLAGS_JDK_COMMON_CONLY="$TOOLCHAIN_CFLAGS_JDK_CONLY  \
777       $WARNING_CFLAGS_JDK_CONLY ${$2EXTRA_CFLAGS}"
778   CFLAGS_JDK_COMMON_CXXONLY="$ALWAYS_DEFINES_JDK_CXXONLY $TOOLCHAIN_CFLAGS_JDK_CXXONLY \
779       $WARNING_CFLAGS_JDK_CXXONLY ${$2EXTRA_CXXFLAGS}"
780 
781   $1_CFLAGS_JVM="${$1_DEFINES_CPU_JVM} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JVM} ${$1_TOOLCHAIN_CFLAGS} ${$1_WARNING_CFLAGS_JVM}"
782   $1_CFLAGS_JDK="${$1_DEFINES_CPU_JDK} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JDK} ${$1_TOOLCHAIN_CFLAGS}"
783 
784   $2JVM_CFLAGS="$CFLAGS_JVM_COMMON ${$1_CFLAGS_JVM} ${$2EXTRA_CXXFLAGS}"
785 
786   $2CFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CONLY ${$1_CFLAGS_JDK}"
787   $2CXXFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CXXONLY ${$1_CFLAGS_JDK}"
788   $2CFLAGS_JDKLIB="${$2CFLAGS_JDKEXE} $JDK_PICFLAG ${$1_CFLAGS_CPU_JDK_LIBONLY}"
789   $2CXXFLAGS_JDKLIB="${$2CXXFLAGS_JDKEXE} $JDK_PICFLAG ${$1_CFLAGS_CPU_JDK_LIBONLY}"
790 
791   AC_SUBST($2JVM_CFLAGS)
792   AC_SUBST($2CFLAGS_JDKLIB)
793   AC_SUBST($2CFLAGS_JDKEXE)
794   AC_SUBST($2CXXFLAGS_JDKLIB)
795   AC_SUBST($2CXXFLAGS_JDKEXE)
796 ])
797 
798 # FLAGS_SETUP_GCC6_COMPILER_FLAGS([PREFIX])
799 # Arguments:
800 # $1 - Prefix for each variable defined.
801 AC_DEFUN([FLAGS_SETUP_GCC6_COMPILER_FLAGS],
802 [
803   # These flags are required for GCC 6 builds as undefined behaviour in OpenJDK code
804   # runs afoul of the more aggressive versions of these optimisations.
805   # Notably, value range propagation now assumes that the this pointer of C++
806   # member functions is non-null.
807   NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks"
808   dnl Argument check is disabled until FLAGS_COMPILER_CHECK_ARGUMENTS handles cross-compilation
809   dnl FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror],
810   dnl					     IF_FALSE: [NO_DELETE_NULL_POINTER_CHECKS_CFLAG=""])
811   NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
812   dnl Argument check is disabled until FLAGS_COMPILER_CHECK_ARGUMENTS handles cross-compilation
813   dnl FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_LIFETIME_DSE_CFLAG -Werror],
814   dnl					     IF_FALSE: [NO_LIFETIME_DSE_CFLAG=""])
815   AC_MSG_NOTICE([GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} and ${NO_LIFETIME_DSE_CFLAG}])
816   $1_GCC6_CFLAGS="${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
817 ])
818 
819 # Documentation on common flags used for solstudio in HIGHEST.
820 #
821 # WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be
822 #          done with care, there are some assumptions below that need to
823 #          be understood about the use of pointers, and IEEE behavior.
824 #
825 # -fns: Use non-standard floating point mode (not IEEE 754)
826 # -fsimple: Do some simplification of floating point arithmetic (not IEEE 754)
827 # -fsingle: Use single precision floating point with 'float'
828 # -xalias_level=basic: Assume memory references via basic pointer types do not alias
829 #   (Source with excessing pointer casting and data access with mixed
830 #    pointer types are not recommended)
831 # -xbuiltin=%all: Use intrinsic or inline versions for math/std functions
832 #   (If you expect perfect errno behavior, do not use this)
833 # -xdepend: Loop data dependency optimizations (need -xO3 or higher)
834 # -xrestrict: Pointer parameters to functions do not overlap
835 #   (Similar to -xalias_level=basic usage, but less obvious sometimes.
836 #    If you pass in multiple pointers to the same data, do not use this)
837 # -xlibmil: Inline some library routines
838 #   (If you expect perfect errno behavior, do not use this)
839 # -xlibmopt: Use optimized math routines (CURRENTLY DISABLED)
840 #   (If you expect perfect errno behavior, do not use this)
841 #  Can cause undefined external on Solaris 8 X86 on __sincos, removing for now