author | ihse |
Thu, 17 Oct 2019 11:37:36 +0200 | |
branch | ihse-cflags-rewrite-branch |
changeset 58666 | 50a4f2770d1f |
parent 58665 | 30a5049a36bb |
child 58733 | fd8dc801ef32 |
permissions | -rw-r--r-- |
49120 | 1 |
# |
54490
bf07e140c49c
8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
erikj
parents:
53837
diff
changeset
|
2 |
# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. |
49120 | 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 |
[ |
|
51095 | 109 |
# By default don't set any specific assembler debug |
110 |
# info flags for toolchains unless we know they work. |
|
111 |
# See JDK-8207057. |
|
112 |
ASFLAGS_DEBUG_SYMBOLS="" |
|
49120 | 113 |
# Debug symbols |
114 |
if test "x$TOOLCHAIN_TYPE" = xgcc; then |
|
49156
6aaf3aef2d67
8199331: Don't limit debug information for fastdebug JDK native libraries
ihse
parents:
49155
diff
changeset
|
115 |
CFLAGS_DEBUG_SYMBOLS="-g" |
51095 | 116 |
ASFLAGS_DEBUG_SYMBOLS="-g" |
49120 | 117 |
elif test "x$TOOLCHAIN_TYPE" = xclang; then |
118 |
CFLAGS_DEBUG_SYMBOLS="-g" |
|
51095 | 119 |
ASFLAGS_DEBUG_SYMBOLS="-g" |
49120 | 120 |
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
121 |
# -g0 enables debug symbols without disabling inlining. |
|
49155
7cd937277d5e
8199338: Use -g0 on solstudio also for compiling C programs
ihse
parents:
49120
diff
changeset
|
122 |
CFLAGS_DEBUG_SYMBOLS="-g0 -xs" |
49120 | 123 |
elif test "x$TOOLCHAIN_TYPE" = xxlc; then |
57975
a333fdeb8de0
8224214: [AIX] Remove support for legacy xlc compiler
mbaesken
parents:
57481
diff
changeset
|
124 |
CFLAGS_DEBUG_SYMBOLS="-g1" |
49120 | 125 |
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then |
49160
cefb7b496d17
8199347: Always use -Z7 for debug symbols when compiling on Windows
ihse
parents:
49156
diff
changeset
|
126 |
CFLAGS_DEBUG_SYMBOLS="-Z7 -d2Zi+" |
49120 | 127 |
fi |
128 |
||
129 |
AC_SUBST(CFLAGS_DEBUG_SYMBOLS) |
|
51095 | 130 |
AC_SUBST(ASFLAGS_DEBUG_SYMBOLS) |
49120 | 131 |
]) |
132 |
||
133 |
AC_DEFUN([FLAGS_SETUP_WARNINGS], |
|
134 |
[ |
|
135 |
AC_ARG_ENABLE([warnings-as-errors], [AS_HELP_STRING([--disable-warnings-as-errors], |
|
136 |
[do not consider native warnings to be an error @<:@enabled@:>@])]) |
|
137 |
||
49907
1ca3406a2101
8202325: [aix] disable warnings-as-errors by default
stuefe
parents:
49726
diff
changeset
|
138 |
# Set default value. |
1ca3406a2101
8202325: [aix] disable warnings-as-errors by default
stuefe
parents:
49726
diff
changeset
|
139 |
if test "x$TOOLCHAIN_TYPE" = xxlc; then |
1ca3406a2101
8202325: [aix] disable warnings-as-errors by default
stuefe
parents:
49726
diff
changeset
|
140 |
WARNINGS_AS_ERRORS=false |
1ca3406a2101
8202325: [aix] disable warnings-as-errors by default
stuefe
parents:
49726
diff
changeset
|
141 |
else |
1ca3406a2101
8202325: [aix] disable warnings-as-errors by default
stuefe
parents:
49726
diff
changeset
|
142 |
WARNINGS_AS_ERRORS=true |
1ca3406a2101
8202325: [aix] disable warnings-as-errors by default
stuefe
parents:
49726
diff
changeset
|
143 |
fi |
1ca3406a2101
8202325: [aix] disable warnings-as-errors by default
stuefe
parents:
49726
diff
changeset
|
144 |
|
49120 | 145 |
AC_MSG_CHECKING([if native warnings are errors]) |
146 |
if test "x$enable_warnings_as_errors" = "xyes"; then |
|
147 |
AC_MSG_RESULT([yes (explicitly set)]) |
|
148 |
WARNINGS_AS_ERRORS=true |
|
149 |
elif test "x$enable_warnings_as_errors" = "xno"; then |
|
49907
1ca3406a2101
8202325: [aix] disable warnings-as-errors by default
stuefe
parents:
49726
diff
changeset
|
150 |
AC_MSG_RESULT([no (explicitly set)]) |
49120 | 151 |
WARNINGS_AS_ERRORS=false |
152 |
elif test "x$enable_warnings_as_errors" = "x"; then |
|
49907
1ca3406a2101
8202325: [aix] disable warnings-as-errors by default
stuefe
parents:
49726
diff
changeset
|
153 |
AC_MSG_RESULT([${WARNINGS_AS_ERRORS} (default)]) |
49120 | 154 |
else |
155 |
AC_MSG_ERROR([--enable-warnings-as-errors accepts no argument]) |
|
156 |
fi |
|
157 |
||
158 |
AC_SUBST(WARNINGS_AS_ERRORS) |
|
159 |
||
56217 | 160 |
LDFLAGS_WARNINGS_ARE_ERRORS="" |
49120 | 161 |
case "${TOOLCHAIN_TYPE}" in |
162 |
microsoft) |
|
163 |
DISABLE_WARNING_PREFIX="-wd" |
|
164 |
CFLAGS_WARNINGS_ARE_ERRORS="-WX" |
|
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
165 |
|
56250
d64ab781c927
Back away from -Wall to -W4 on windows, at least initially.
ihse
parents:
56249
diff
changeset
|
166 |
# 4061 |
d64ab781c927
Back away from -Wall to -W4 on windows, at least initially.
ihse
parents:
56249
diff
changeset
|
167 |
#WARNINGS_ENABLE_ALL="-Wall" |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
168 |
WARNINGS_ENABLE_ALL="-W3" |
56760 | 169 |
# W4 and Wall is higher but is too link-like. |
170 |
#WARNINGS_ENABLE_ALL="-W4" |
|
56250
d64ab781c927
Back away from -Wall to -W4 on windows, at least initially.
ihse
parents:
56249
diff
changeset
|
171 |
# 4061, 4062 = enum not handled |
d64ab781c927
Back away from -Wall to -W4 on windows, at least initially.
ihse
parents:
56249
diff
changeset
|
172 |
# 4130 |
d64ab781c927
Back away from -Wall to -W4 on windows, at least initially.
ihse
parents:
56249
diff
changeset
|
173 |
#EVEN_MORE="4054 4055 4057 4100 4127 4131 4132 4152 4201 4204 4206 4210 4232 4244 4255 4263 4264 4295 4302 4306 4311 4324 4366 4388 4512 4548 4555 4574 4800 4986 4987" |
d64ab781c927
Back away from -Wall to -W4 on windows, at least initially.
ihse
parents:
56249
diff
changeset
|
174 |
#INIT_DISABLE=" 4189 4191 4211 4242 4245 4265 4287 4296 4310 4312 4350 4355 4365 4389 4505 4510 4514 4571 4610 4619 4623 4625 4626 4640 4668 4701 4702 4703 4706 4710 4711 4820 4917 4946 $EVEN_MORE" |
d64ab781c927
Back away from -Wall to -W4 on windows, at least initially.
ihse
parents:
56249
diff
changeset
|
175 |
#DISABLED_WARNINGS_WALL="4061 4062 $INIT_DISABLE" |
d64ab781c927
Back away from -Wall to -W4 on windows, at least initially.
ihse
parents:
56249
diff
changeset
|
176 |
RETRY_W4_HOTSPOT="4189 4211 4245 4310 4389 4505 4510 4610 4701 4702 4703 4706" |
d64ab781c927
Back away from -Wall to -W4 on windows, at least initially.
ihse
parents:
56249
diff
changeset
|
177 |
RETRY_W4_JDK="4054 4055 4057 4100 4127 4130 4131 4132 4152 4201 4204 4206 4210 4232 4244 4295 4306 4324 4366 4512 4800" |
56760 | 178 |
DISABLED_WARNINGS="4456" |
56900 | 179 |
# make sure we get this one: WARNING_CFLAGS_JVM="-wd4800" (-Wreorder) |
56760 | 180 |
#was: $RETRY_W4_HOTSPOT $RETRY_W4_JDK 4061 4242 4255 4265 4365 4456 4459 4514 4619 4623 4625 4626 4668 4710 4820 5026 5027 5038 5039 4596 4571 4577 4605 4774" |
49120 | 181 |
;; |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
182 |
|
49120 | 183 |
solstudio) |
184 |
DISABLE_WARNING_PREFIX="-erroff=" |
|
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
185 |
CFLAGS_WARNINGS_ARE_ERRORS="-errwarn=%all" |
56217 | 186 |
LDFLAGS_WARNINGS_ARE_ERRORS="-Wl,-z,fatal-warnings" |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
187 |
|
56219 | 188 |
WARNINGS_ENABLE_ALL_CFLAGS="-v -fd -xtransition" |
56222 | 189 |
WARNINGS_ENABLE_ALL_CXXFLAGS="+w +w2" |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
190 |
|
56249
4141c47bb309
Promote E_DECLARATION_IN_CODE to global disable on solaris.
ihse
parents:
56242
diff
changeset
|
191 |
DISABLED_WARNINGS_C="E_OLD_STYLE_FUNC_DECL E_OLD_STYLE_FUNC_DEF E_SEMANTICS_OF_OP_CHG_IN_ANSI_C E_NO_REPLACEMENT_IN_STRING E_DECLARATION_IN_CODE" |
56240 | 192 |
DISABLED_WARNINGS_CXX="inllargeuse inllargeint notused wemptydecl notemsource" |
193 |
# helpful quality checks, should not be disabled: inllargeuse inllargeint |
|
49120 | 194 |
;; |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
195 |
|
49120 | 196 |
gcc) |
49200 | 197 |
DISABLE_WARNING_PREFIX="-Wno-" |
49120 | 198 |
CFLAGS_WARNINGS_ARE_ERRORS="-Werror" |
56221 | 199 |
# -Wall -Wextra does not enable all warnings. We add some more that we |
200 |
# consider relevant: |
|
58666 | 201 |
# logical-op cannot be used due to https://gcc.gnu.org/bugzilla//show_bug.cgi?id=69602 |
202 |
WARNINGS_ENABLE_ADDITIONAL="-Wpointer-arith -Wundef -Winit-self -Wpacked -Wdisabled-optimization -Wtrampolines" |
|
56238 | 203 |
WARNINGS_ENABLE_ADDITIONAL_CXX="-Wc++0x-compat -Wreorder -Wnoexcept -Woverloaded-virtual -Wdelete-non-virtual-dtor -Wwrite-strings -Wstrict-null-sentinel" |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
204 |
|
56221 | 205 |
WARNINGS_ENABLE_ALL="-Wall -Wextra -Wformat=2 $WARNINGS_ENABLE_ADDITIONAL" |
206 |
WARNINGS_ENABLE_ALL_CXXFLAGS="$WARNINGS_ENABLE_ADDITIONAL_CXX" |
|
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
207 |
|
56238 | 208 |
DISABLED_WARNINGS_JUST_GET_THIS_PASS="unused-variable unused-function unused-but-set-variable undef unused-value unused-label pointer-arith" |
56899 | 209 |
DISABLED_WARNINGS="unused-parameter $DISABLED_WARNINGS_JUST_GET_THIS_PASS" |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
210 |
|
49120 | 211 |
# Repeate the check for the BUILD_CC and BUILD_CXX. Need to also reset |
212 |
# CFLAGS since any target specific flags will likely not work with the |
|
213 |
# build compiler |
|
214 |
CC_OLD="$CC" |
|
215 |
CXX_OLD="$CXX" |
|
216 |
CC="$BUILD_CC" |
|
217 |
CXX="$BUILD_CXX" |
|
218 |
CFLAGS_OLD="$CFLAGS" |
|
219 |
CFLAGS="" |
|
49200 | 220 |
BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-" |
49120 | 221 |
CC="$CC_OLD" |
222 |
CXX="$CXX_OLD" |
|
223 |
CFLAGS="$CFLAGS_OLD" |
|
224 |
;; |
|
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
225 |
|
49120 | 226 |
clang) |
227 |
DISABLE_WARNING_PREFIX="-Wno-" |
|
228 |
CFLAGS_WARNINGS_ARE_ERRORS="-Werror" |
|
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
229 |
|
51853
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
230 |
# Additional warnings that are not activated by -Wall and -Wextra |
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
231 |
WARNINGS_ENABLE_ADDITIONAL="-Wpointer-arith -Wsign-compare -Wreorder \ |
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
232 |
-Wunused-function -Wundef -Wunused-value -Woverloaded-virtual" |
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
233 |
WARNINGS_ENABLE_ALL="-Wall -Wextra -Wformat=2 $WARNINGS_ENABLE_ADDITIONAL" |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
234 |
|
54711
297ddf282627
8223309: test failing due to self-assign-overloaded
erikj
parents:
54646
diff
changeset
|
235 |
DISABLED_WARNINGS="unknown-warning-option unused-parameter unused" |
51853
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
236 |
|
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
237 |
if test "x$OPENJDK_TARGET_OS" = xmacosx; then |
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
238 |
# missing-method-return-type triggers in JavaNativeFoundation framework |
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
239 |
DISABLED_WARNINGS="$DISABLED_WARNINGS missing-method-return-type" |
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
240 |
fi |
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
241 |
|
49120 | 242 |
;; |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
243 |
|
49120 | 244 |
xlc) |
57481
aaa83519e723
8228426: xlc: switch to clang-style warning disabling
mbaesken
parents:
55623
diff
changeset
|
245 |
DISABLE_WARNING_PREFIX="-Wno-" |
49120 | 246 |
CFLAGS_WARNINGS_ARE_ERRORS="-qhalt=w" |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
247 |
|
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
248 |
# Possibly a better subset than "all" is "lan:trx:ret:zea:cmp:ret" |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
249 |
WARNINGS_ENABLE_ALL="-qinfo=all -qformat=all" |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
250 |
DISABLED_WARNINGS="" |
49120 | 251 |
;; |
252 |
esac |
|
253 |
AC_SUBST(DISABLE_WARNING_PREFIX) |
|
254 |
AC_SUBST(BUILD_CC_DISABLE_WARNING_PREFIX) |
|
255 |
AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS) |
|
56217 | 256 |
AC_SUBST(LDFLAGS_WARNINGS_ARE_ERRORS) |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
257 |
AC_SUBST(DISABLED_WARNINGS) |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
258 |
AC_SUBST(DISABLED_WARNINGS_C) |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
259 |
AC_SUBST(DISABLED_WARNINGS_CXX) |
49120 | 260 |
]) |
261 |
||
262 |
AC_DEFUN([FLAGS_SETUP_QUALITY_CHECKS], |
|
263 |
[ |
|
264 |
# bounds, memory and behavior checking options |
|
265 |
if test "x$TOOLCHAIN_TYPE" = xgcc; then |
|
266 |
case $DEBUG_LEVEL in |
|
267 |
release ) |
|
268 |
# no adjustment |
|
269 |
;; |
|
270 |
fastdebug ) |
|
271 |
# no adjustment |
|
272 |
;; |
|
273 |
slowdebug ) |
|
274 |
# FIXME: By adding this to C(XX)FLAGS_DEBUG_OPTIONS/JVM_CFLAGS_SYMBOLS it |
|
275 |
# get's added conditionally on whether we produce debug symbols or not. |
|
276 |
# This is most likely not really correct. |
|
277 |
||
278 |
# Add runtime stack smashing and undefined behavior checks. |
|
56312 | 279 |
CFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param ssp-buffer-size=1 -Wstack-protector" |
280 |
CXXFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param ssp-buffer-size=1 -Wstack-protector" |
|
49120 | 281 |
|
56312 | 282 |
JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -fstack-protector-all --param ssp-buffer-size=1 -Wstack-protector" |
49120 | 283 |
;; |
284 |
esac |
|
285 |
fi |
|
286 |
]) |
|
287 |
||
288 |
AC_DEFUN([FLAGS_SETUP_OPTIMIZATION], |
|
289 |
[ |
|
290 |
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
|
291 |
CC_HIGHEST="-fns -fsimple -fsingle -xbuiltin=%all -xdepend -xrestrict -xlibmil" |
|
292 |
||
293 |
C_O_FLAG_HIGHEST_JVM="-xO4" |
|
294 |
C_O_FLAG_DEBUG_JVM="" |
|
295 |
C_O_FLAG_SIZE="" |
|
296 |
C_O_FLAG_DEBUG="" |
|
297 |
C_O_FLAG_NONE="" |
|
298 |
if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then |
|
299 |
C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST" |
|
300 |
C_O_FLAG_HI="-xO4 -Wu,-O4~yz" |
|
301 |
C_O_FLAG_NORM="-xO2 -Wu,-O2~yz" |
|
302 |
elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then |
|
303 |
C_O_FLAG_HIGHEST="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0 \ |
|
50645
9cdde9293187
8205110: Fix xchip warnings with new Solaris toolchain
gadams
parents:
50550
diff
changeset
|
304 |
-xprefetch=auto,explicit $CC_HIGHEST" |
49120 | 305 |
C_O_FLAG_HI="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0" |
306 |
C_O_FLAG_NORM="-xO2 -Wc,-Qrm-s -Wc,-Qiselect-T0" |
|
307 |
fi |
|
308 |
elif test "x$TOOLCHAIN_TYPE" = xgcc; then |
|
309 |
C_O_FLAG_HIGHEST_JVM="-O3" |
|
310 |
C_O_FLAG_HIGHEST="-O3" |
|
311 |
C_O_FLAG_HI="-O3" |
|
312 |
C_O_FLAG_NORM="-O2" |
|
313 |
C_O_FLAG_SIZE="-Os" |
|
314 |
C_O_FLAG_DEBUG="-O0" |
|
315 |
C_O_FLAG_DEBUG_JVM="-O0" |
|
316 |
C_O_FLAG_NONE="-O0" |
|
54937
7e5e0b326ed7
8130017: use _FORTIFY_SOURCE in gcc fastdebug builds
mbaesken
parents:
54711
diff
changeset
|
317 |
# -D_FORTIFY_SOURCE=2 hardening option needs optimization (at least -O1) enabled |
7e5e0b326ed7
8130017: use _FORTIFY_SOURCE in gcc fastdebug builds
mbaesken
parents:
54711
diff
changeset
|
318 |
# set for lower O-levels -U_FORTIFY_SOURCE to overwrite previous settings |
7e5e0b326ed7
8130017: use _FORTIFY_SOURCE in gcc fastdebug builds
mbaesken
parents:
54711
diff
changeset
|
319 |
if test "x$OPENJDK_TARGET_OS" = xlinux -a "x$DEBUG_LEVEL" = "xfastdebug"; then |
7e5e0b326ed7
8130017: use _FORTIFY_SOURCE in gcc fastdebug builds
mbaesken
parents:
54711
diff
changeset
|
320 |
ENABLE_FORTIFY_CFLAGS="-D_FORTIFY_SOURCE=2" |
7e5e0b326ed7
8130017: use _FORTIFY_SOURCE in gcc fastdebug builds
mbaesken
parents:
54711
diff
changeset
|
321 |
DISABLE_FORTIFY_CFLAGS="-U_FORTIFY_SOURCE" |
7e5e0b326ed7
8130017: use _FORTIFY_SOURCE in gcc fastdebug builds
mbaesken
parents:
54711
diff
changeset
|
322 |
C_O_FLAG_HIGHEST_JVM="${C_O_FLAG_HIGHEST_JVM} ${ENABLE_FORTIFY_CFLAGS}" |
7e5e0b326ed7
8130017: use _FORTIFY_SOURCE in gcc fastdebug builds
mbaesken
parents:
54711
diff
changeset
|
323 |
C_O_FLAG_HIGHEST="${C_O_FLAG_HIGHEST} ${ENABLE_FORTIFY_CFLAGS}" |
7e5e0b326ed7
8130017: use _FORTIFY_SOURCE in gcc fastdebug builds
mbaesken
parents:
54711
diff
changeset
|
324 |
C_O_FLAG_HI="${C_O_FLAG_HI} ${ENABLE_FORTIFY_CFLAGS}" |
7e5e0b326ed7
8130017: use _FORTIFY_SOURCE in gcc fastdebug builds
mbaesken
parents:
54711
diff
changeset
|
325 |
C_O_FLAG_NORM="${C_O_FLAG_NORM} ${ENABLE_FORTIFY_CFLAGS}" |
7e5e0b326ed7
8130017: use _FORTIFY_SOURCE in gcc fastdebug builds
mbaesken
parents:
54711
diff
changeset
|
326 |
C_O_FLAG_SIZE="${C_O_FLAG_SIZE} ${DISABLE_FORTIFY_CFLAGS}" |
7e5e0b326ed7
8130017: use _FORTIFY_SOURCE in gcc fastdebug builds
mbaesken
parents:
54711
diff
changeset
|
327 |
C_O_FLAG_DEBUG="${C_O_FLAG_DEBUG} ${DISABLE_FORTIFY_CFLAGS}" |
7e5e0b326ed7
8130017: use _FORTIFY_SOURCE in gcc fastdebug builds
mbaesken
parents:
54711
diff
changeset
|
328 |
C_O_FLAG_DEBUG_JVM="${C_O_FLAG_DEBUG_JVM} ${DISABLE_FORTIFY_CFLAGS}" |
7e5e0b326ed7
8130017: use _FORTIFY_SOURCE in gcc fastdebug builds
mbaesken
parents:
54711
diff
changeset
|
329 |
C_O_FLAG_NONE="${C_O_FLAG_NONE} ${DISABLE_FORTIFY_CFLAGS}" |
7e5e0b326ed7
8130017: use _FORTIFY_SOURCE in gcc fastdebug builds
mbaesken
parents:
54711
diff
changeset
|
330 |
fi |
49120 | 331 |
elif test "x$TOOLCHAIN_TYPE" = xclang; then |
332 |
if test "x$OPENJDK_TARGET_OS" = xmacosx; then |
|
333 |
# On MacOSX we optimize for size, something |
|
334 |
# we should do for all platforms? |
|
335 |
C_O_FLAG_HIGHEST_JVM="-Os" |
|
336 |
C_O_FLAG_HIGHEST="-Os" |
|
337 |
C_O_FLAG_HI="-Os" |
|
338 |
C_O_FLAG_NORM="-Os" |
|
339 |
C_O_FLAG_DEBUG_JVM="" |
|
340 |
else |
|
341 |
C_O_FLAG_HIGHEST_JVM="-O3" |
|
342 |
C_O_FLAG_HIGHEST="-O3" |
|
343 |
C_O_FLAG_HI="-O3" |
|
344 |
C_O_FLAG_NORM="-O2" |
|
345 |
C_O_FLAG_DEBUG_JVM="-O0" |
|
346 |
fi |
|
347 |
C_O_FLAG_SIZE="-Os" |
|
348 |
C_O_FLAG_DEBUG="-O0" |
|
349 |
C_O_FLAG_NONE="-O0" |
|
350 |
elif test "x$TOOLCHAIN_TYPE" = xxlc; then |
|
351 |
C_O_FLAG_HIGHEST_JVM="-O3 -qhot=level=1 -qinline -qinlglue" |
|
352 |
C_O_FLAG_HIGHEST="-O3 -qhot=level=1 -qinline -qinlglue" |
|
353 |
C_O_FLAG_HI="-O3 -qinline -qinlglue" |
|
354 |
C_O_FLAG_NORM="-O2" |
|
355 |
C_O_FLAG_DEBUG="-qnoopt" |
|
356 |
# FIXME: Value below not verified. |
|
357 |
C_O_FLAG_DEBUG_JVM="" |
|
358 |
C_O_FLAG_NONE="-qnoopt" |
|
359 |
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then |
|
360 |
C_O_FLAG_HIGHEST_JVM="-O2 -Oy-" |
|
361 |
C_O_FLAG_HIGHEST="-O2" |
|
362 |
C_O_FLAG_HI="-O1" |
|
363 |
C_O_FLAG_NORM="-O1" |
|
364 |
C_O_FLAG_DEBUG="-Od" |
|
365 |
C_O_FLAG_DEBUG_JVM="" |
|
366 |
C_O_FLAG_NONE="-Od" |
|
367 |
C_O_FLAG_SIZE="-Os" |
|
368 |
fi |
|
369 |
||
370 |
# Now copy to C++ flags |
|
371 |
CXX_O_FLAG_HIGHEST_JVM="$C_O_FLAG_HIGHEST_JVM" |
|
372 |
CXX_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST" |
|
373 |
CXX_O_FLAG_HI="$C_O_FLAG_HI" |
|
374 |
CXX_O_FLAG_NORM="$C_O_FLAG_NORM" |
|
375 |
CXX_O_FLAG_DEBUG="$C_O_FLAG_DEBUG" |
|
376 |
CXX_O_FLAG_DEBUG_JVM="$C_O_FLAG_DEBUG_JVM" |
|
377 |
CXX_O_FLAG_NONE="$C_O_FLAG_NONE" |
|
378 |
CXX_O_FLAG_SIZE="$C_O_FLAG_SIZE" |
|
379 |
||
380 |
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
|
381 |
# In solstudio, also add this to C (but not C++) flags... |
|
382 |
C_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST -xalias_level=basic" |
|
383 |
fi |
|
384 |
||
385 |
# Adjust optimization flags according to debug level. |
|
386 |
case $DEBUG_LEVEL in |
|
387 |
release ) |
|
388 |
# no adjustment |
|
389 |
;; |
|
390 |
fastdebug ) |
|
391 |
# Not quite so much optimization |
|
392 |
C_O_FLAG_HI="$C_O_FLAG_NORM" |
|
393 |
CXX_O_FLAG_HI="$CXX_O_FLAG_NORM" |
|
394 |
;; |
|
395 |
slowdebug ) |
|
396 |
# Disable optimization |
|
397 |
C_O_FLAG_HIGHEST_JVM="$C_O_FLAG_DEBUG_JVM" |
|
398 |
C_O_FLAG_HIGHEST="$C_O_FLAG_DEBUG" |
|
399 |
C_O_FLAG_HI="$C_O_FLAG_DEBUG" |
|
400 |
C_O_FLAG_NORM="$C_O_FLAG_DEBUG" |
|
401 |
C_O_FLAG_SIZE="$C_O_FLAG_DEBUG" |
|
402 |
CXX_O_FLAG_HIGHEST_JVM="$CXX_O_FLAG_DEBUG_JVM" |
|
403 |
CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_DEBUG" |
|
404 |
CXX_O_FLAG_HI="$CXX_O_FLAG_DEBUG" |
|
405 |
CXX_O_FLAG_NORM="$CXX_O_FLAG_DEBUG" |
|
406 |
CXX_O_FLAG_SIZE="$CXX_O_FLAG_DEBUG" |
|
407 |
;; |
|
408 |
esac |
|
409 |
||
410 |
AC_SUBST(C_O_FLAG_HIGHEST_JVM) |
|
411 |
AC_SUBST(C_O_FLAG_HIGHEST) |
|
412 |
AC_SUBST(C_O_FLAG_HI) |
|
413 |
AC_SUBST(C_O_FLAG_NORM) |
|
414 |
AC_SUBST(C_O_FLAG_NONE) |
|
415 |
AC_SUBST(C_O_FLAG_SIZE) |
|
416 |
AC_SUBST(CXX_O_FLAG_HIGHEST_JVM) |
|
417 |
AC_SUBST(CXX_O_FLAG_HIGHEST) |
|
418 |
AC_SUBST(CXX_O_FLAG_HI) |
|
419 |
AC_SUBST(CXX_O_FLAG_NORM) |
|
420 |
AC_SUBST(CXX_O_FLAG_NONE) |
|
421 |
AC_SUBST(CXX_O_FLAG_SIZE) |
|
422 |
]) |
|
423 |
||
424 |
AC_DEFUN([FLAGS_SETUP_CFLAGS], |
|
425 |
[ |
|
426 |
### CFLAGS |
|
427 |
||
428 |
FLAGS_SETUP_CFLAGS_HELPER |
|
429 |
||
430 |
FLAGS_OS=$OPENJDK_TARGET_OS |
|
431 |
FLAGS_OS_TYPE=$OPENJDK_TARGET_OS_TYPE |
|
432 |
FLAGS_CPU=$OPENJDK_TARGET_CPU |
|
433 |
FLAGS_CPU_ARCH=$OPENJDK_TARGET_CPU_ARCH |
|
434 |
FLAGS_CPU_BITS=$OPENJDK_TARGET_CPU_BITS |
|
435 |
FLAGS_CPU_ENDIAN=$OPENJDK_TARGET_CPU_ENDIAN |
|
436 |
FLAGS_CPU_LEGACY=$OPENJDK_TARGET_CPU_LEGACY |
|
437 |
FLAGS_CPU_LEGACY_LIB=$OPENJDK_TARGET_CPU_LEGACY_LIB |
|
438 |
||
439 |
FLAGS_SETUP_CFLAGS_CPU_DEP([TARGET]) |
|
440 |
||
441 |
FLAGS_OS=$OPENJDK_BUILD_OS |
|
442 |
FLAGS_OS_TYPE=$OPENJDK_BUILD_OS_TYPE |
|
443 |
FLAGS_CPU=$OPENJDK_BUILD_CPU |
|
444 |
FLAGS_CPU_ARCH=$OPENJDK_BUILD_CPU_ARCH |
|
445 |
FLAGS_CPU_BITS=$OPENJDK_BUILD_CPU_BITS |
|
446 |
FLAGS_CPU_ENDIAN=$OPENJDK_BUILD_CPU_ENDIAN |
|
447 |
FLAGS_CPU_LEGACY=$OPENJDK_BUILD_CPU_LEGACY |
|
448 |
FLAGS_CPU_LEGACY_LIB=$OPENJDK_BUILD_CPU_LEGACY_LIB |
|
449 |
||
53643
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
450 |
FLAGS_SETUP_CFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_], [BUILD_]) |
49120 | 451 |
]) |
452 |
||
453 |
################################################################################ |
|
454 |
# platform independent |
|
455 |
AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER], |
|
456 |
[ |
|
457 |
#### OS DEFINES, these should be independent on toolchain |
|
458 |
if test "x$OPENJDK_TARGET_OS" = xlinux; then |
|
459 |
CFLAGS_OS_DEF_JVM="-DLINUX" |
|
460 |
CFLAGS_OS_DEF_JDK="-D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE" |
|
461 |
elif test "x$OPENJDK_TARGET_OS" = xsolaris; then |
|
462 |
CFLAGS_OS_DEF_JVM="-DSOLARIS" |
|
463 |
CFLAGS_OS_DEF_JDK="-D__solaris__" |
|
464 |
elif test "x$OPENJDK_TARGET_OS" = xmacosx; then |
|
465 |
CFLAGS_OS_DEF_JVM="-D_ALLBSD_SOURCE -D_DARWIN_C_SOURCE -D_XOPEN_SOURCE" |
|
466 |
CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT" |
|
467 |
elif test "x$OPENJDK_TARGET_OS" = xaix; then |
|
468 |
CFLAGS_OS_DEF_JVM="-DAIX" |
|
469 |
elif test "x$OPENJDK_TARGET_OS" = xbsd; then |
|
470 |
CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE" |
|
471 |
elif test "x$OPENJDK_TARGET_OS" = xwindows; then |
|
472 |
CFLAGS_OS_DEF_JVM="-D_WINDOWS -DWIN32 -D_JNI_IMPLEMENTATION_" |
|
473 |
fi |
|
474 |
||
475 |
CFLAGS_OS_DEF_JDK="$CFLAGS_OS_DEF_JDK -D$OPENJDK_TARGET_OS_UPPERCASE" |
|
476 |
||
477 |
#### GLOBAL DEFINES |
|
478 |
# Set some common defines. These works for all compilers, but assume |
|
479 |
# -D is universally accepted. |
|
480 |
||
481 |
# Always enable optional macros for VM. |
|
482 |
ALWAYS_CFLAGS_JVM="-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS" |
|
483 |
||
484 |
# Setup some hard coded includes |
|
485 |
ALWAYS_CFLAGS_JDK=" \ |
|
486 |
-I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \ |
|
487 |
-I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base/\$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \ |
|
488 |
-I${TOPDIR}/src/java.base/share/native/libjava \ |
|
489 |
-I${TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/libjava \ |
|
490 |
-I${TOPDIR}/src/hotspot/share/include \ |
|
491 |
-I${TOPDIR}/src/hotspot/os/${HOTSPOT_TARGET_OS_TYPE}/include" |
|
492 |
||
493 |
############################################################################### |
|
494 |
||
495 |
# Adjust flags according to debug level. |
|
496 |
# Setup debug/release defines |
|
497 |
if test "x$DEBUG_LEVEL" = xrelease; then |
|
498 |
DEBUG_CFLAGS_JDK="-DNDEBUG" |
|
499 |
if test "x$OPENJDK_TARGET_OS" = xsolaris; then |
|
500 |
DEBUG_CFLAGS_JDK="$DEBUG_CFLAGS_JDK -DTRIMMED" |
|
501 |
fi |
|
502 |
else |
|
503 |
DEBUG_CFLAGS_JDK="-DDEBUG" |
|
504 |
||
505 |
if test "x$TOOLCHAIN_TYPE" = xxlc; then |
|
506 |
# We need '-qminimaltoc' or '-qpic=large -bbigtoc' if the TOC overflows. |
|
507 |
# Hotspot now overflows its 64K TOC (currently only for debug), |
|
508 |
# so for debug we build with '-qpic=large -bbigtoc'. |
|
509 |
DEBUG_CFLAGS_JVM="-qpic=large" |
|
510 |
fi |
|
511 |
fi |
|
512 |
||
513 |
if test "x$DEBUG_LEVEL" != xrelease; then |
|
514 |
DEBUG_OPTIONS_FLAGS_JDK="$CFLAGS_DEBUG_OPTIONS" |
|
515 |
DEBUG_SYMBOLS_CFLAGS_JDK="$CFLAGS_DEBUG_SYMBOLS" |
|
516 |
fi |
|
517 |
||
518 |
#### TOOLCHAIN DEFINES |
|
519 |
||
520 |
if test "x$TOOLCHAIN_TYPE" = xgcc; then |
|
521 |
ALWAYS_DEFINES_JVM="-D_GNU_SOURCE -D_REENTRANT" |
|
522 |
elif test "x$TOOLCHAIN_TYPE" = xclang; then |
|
523 |
ALWAYS_DEFINES_JVM="-D_GNU_SOURCE" |
|
524 |
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
|
525 |
ALWAYS_DEFINES_JVM="-DSPARC_WORKS -D_Crun_inline_placement" |
|
526 |
ALWAYS_DEFINES_JDK="-DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS" |
|
527 |
ALWAYS_DEFINES_JDK_CXXONLY="-DCC_NOEX" |
|
528 |
elif test "x$TOOLCHAIN_TYPE" = xxlc; then |
|
529 |
ALWAYS_DEFINES_JVM="-D_REENTRANT" |
|
530 |
ALWAYS_DEFINES_JDK="-D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC" |
|
531 |
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then |
|
532 |
ALWAYS_DEFINES_JDK="-DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE \ |
|
533 |
-D_CRT_NONSTDC_NO_DEPRECATE -DWIN32 -DIAL" |
|
49726
4ae63fcabe2e
8199736: Define WIN32_LEAN_AND_MEAN before including windows.h
rwestberg
parents:
49679
diff
changeset
|
534 |
ALWAYS_DEFINES_JVM="-DNOMINMAX -DWIN32_LEAN_AND_MEAN" |
49120 | 535 |
fi |
536 |
||
537 |
############################################################################### |
|
538 |
# |
|
539 |
# |
|
540 |
# CFLAGS BASIC |
|
541 |
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then |
|
542 |
# COMMON to gcc and clang |
|
543 |
TOOLCHAIN_CFLAGS_JVM="-pipe -fno-rtti -fno-exceptions \ |
|
544 |
-fvisibility=hidden -fno-strict-aliasing -fno-omit-frame-pointer" |
|
545 |
fi |
|
546 |
||
547 |
if test "x$TOOLCHAIN_TYPE" = xgcc; then |
|
53332 | 548 |
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -fcheck-new -fstack-protector" |
549 |
TOOLCHAIN_CFLAGS_JDK="-pipe -fstack-protector" |
|
53643
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
550 |
# technically NOT for CXX (but since this gives *worse* performance, use |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
551 |
# no-strict-aliasing everywhere!) |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
552 |
TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" |
49120 | 553 |
|
554 |
elif test "x$TOOLCHAIN_TYPE" = xclang; then |
|
555 |
# Restrict the debug information created by Clang to avoid |
|
556 |
# too big object files and speed the build up a little bit |
|
557 |
# (see http://llvm.org/bugs/show_bug.cgi?id=7554) |
|
558 |
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -flimit-debug-info" |
|
559 |
||
50781 | 560 |
# In principle the stack alignment below is cpu- and ABI-dependent and |
561 |
# should agree with values of StackAlignmentInBytes in various |
|
562 |
# src/hotspot/cpu/*/globalDefinitions_*.hpp files, but this value currently |
|
563 |
# works for all platforms. |
|
564 |
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -mno-omit-leaf-frame-pointer -mstack-alignment=16" |
|
565 |
||
49120 | 566 |
if test "x$OPENJDK_TARGET_OS" = xlinux; then |
54646
5b1eec609909
8220388: Increase -inlinehint-threshold for Clang to avoid G1 pause time regression
manc
parents:
54490
diff
changeset
|
567 |
if test "x$DEBUG_LEVEL" = xrelease; then |
5b1eec609909
8220388: Increase -inlinehint-threshold for Clang to avoid G1 pause time regression
manc
parents:
54490
diff
changeset
|
568 |
# Clang does not inline as much as GCC does for functions with "inline" keyword by default. |
5b1eec609909
8220388: Increase -inlinehint-threshold for Clang to avoid G1 pause time regression
manc
parents:
54490
diff
changeset
|
569 |
# This causes noticeable slowdown in pause time for G1, and possibly in other areas. |
5b1eec609909
8220388: Increase -inlinehint-threshold for Clang to avoid G1 pause time regression
manc
parents:
54490
diff
changeset
|
570 |
# Increasing the inline hint threshold avoids the slowdown for Clang-built JVM. |
5b1eec609909
8220388: Increase -inlinehint-threshold for Clang to avoid G1 pause time regression
manc
parents:
54490
diff
changeset
|
571 |
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -mllvm -inlinehint-threshold=100000" |
5b1eec609909
8220388: Increase -inlinehint-threshold for Clang to avoid G1 pause time regression
manc
parents:
54490
diff
changeset
|
572 |
fi |
49120 | 573 |
TOOLCHAIN_CFLAGS_JDK="-pipe" |
574 |
TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX |
|
575 |
fi |
|
576 |
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
|
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
577 |
TOOLCHAIN_FLAGS="-errtags -errfmt" |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
578 |
TOOLCHAIN_CFLAGS="-errshort=tags" |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
579 |
|
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
580 |
TOOLCHAIN_CFLAGS_JDK="-mt $TOOLCHAIN_FLAGS" |
56222 | 581 |
TOOLCHAIN_CFLAGS_JDK_CONLY="-xc99=%none -xCC -Xa -W0,-noglobal $TOOLCHAIN_CFLAGS" # C only |
49120 | 582 |
TOOLCHAIN_CFLAGS_JDK_CXXONLY="-features=no%except -norunpath -xnolib" # CXX only |
583 |
TOOLCHAIN_CFLAGS_JVM="-template=no%extdef -features=no%split_init \ |
|
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
584 |
-library=stlport4 -mt -features=no%except $TOOLCHAIN_FLAGS" |
49155
7cd937277d5e
8199338: Use -g0 on solstudio also for compiling C programs
ihse
parents:
49120
diff
changeset
|
585 |
if test "x$DEBUG_LEVEL" = xslowdebug; then |
7cd937277d5e
8199338: Use -g0 on solstudio also for compiling C programs
ihse
parents:
49120
diff
changeset
|
586 |
# Previously -g was used instead of -g0 for slowdebug; this is equivalent |
7cd937277d5e
8199338: Use -g0 on solstudio also for compiling C programs
ihse
parents:
49120
diff
changeset
|
587 |
# to setting +d. |
7cd937277d5e
8199338: Use -g0 on solstudio also for compiling C programs
ihse
parents:
49120
diff
changeset
|
588 |
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM +d" |
7cd937277d5e
8199338: Use -g0 on solstudio also for compiling C programs
ihse
parents:
49120
diff
changeset
|
589 |
fi |
7cd937277d5e
8199338: Use -g0 on solstudio also for compiling C programs
ihse
parents:
49120
diff
changeset
|
590 |
|
49120 | 591 |
elif test "x$TOOLCHAIN_TYPE" = xxlc; then |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
592 |
# Suggested additions: -qsrcmsg to get improved error reporting |
55584
ef032c55234c
8227171: provide function names in native stack trace on aix with xlc16
mbaesken
parents:
54999
diff
changeset
|
593 |
# set -qtbtable=full for a better traceback table/better stacks in hs_err when xlc16 is used |
ef032c55234c
8227171: provide function names in native stack trace on aix with xlc16
mbaesken
parents:
54999
diff
changeset
|
594 |
TOOLCHAIN_CFLAGS_JDK="-qtbtable=full -qchars=signed -qfullpath -qsaveopt -qstackprotect" # add on both CFLAGS |
ef032c55234c
8227171: provide function names in native stack trace on aix with xlc16
mbaesken
parents:
54999
diff
changeset
|
595 |
TOOLCHAIN_CFLAGS_JVM="-qtbtable=full -qtune=balanced \ |
55623
c589ba4b823c
8227389: Remove unsupported xlc16 compile options on aix
mbaesken
parents:
55584
diff
changeset
|
596 |
-qalias=noansi -qstrict -qtls=default -qnortti -qnoeh -qignerrno -qstackprotect" |
49120 | 597 |
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then |
598 |
TOOLCHAIN_CFLAGS_JVM="-nologo -MD -MP" |
|
599 |
TOOLCHAIN_CFLAGS_JDK="-nologo -MD -Zc:wchar_t-" |
|
600 |
fi |
|
601 |
||
54999
98ed47cd114a
8224087: Compile C code for at least C99 Standard compliance
dholmes
parents:
54937
diff
changeset
|
602 |
# CFLAGS C language level for JDK sources (hotspot only uses C++) |
98ed47cd114a
8224087: Compile C code for at least C99 Standard compliance
dholmes
parents:
54937
diff
changeset
|
603 |
# Ideally we would have a common level across all toolchains so that all sources |
98ed47cd114a
8224087: Compile C code for at least C99 Standard compliance
dholmes
parents:
54937
diff
changeset
|
604 |
# are sure to conform to the same standard. Unfortunately neither our sources nor |
98ed47cd114a
8224087: Compile C code for at least C99 Standard compliance
dholmes
parents:
54937
diff
changeset
|
605 |
# our toolchains are in a condition to support that. But what we loosely aim for is |
98ed47cd114a
8224087: Compile C code for at least C99 Standard compliance
dholmes
parents:
54937
diff
changeset
|
606 |
# C99 level. |
98ed47cd114a
8224087: Compile C code for at least C99 Standard compliance
dholmes
parents:
54937
diff
changeset
|
607 |
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang || test "x$TOOLCHAIN_TYPE" = xxlc; then |
98ed47cd114a
8224087: Compile C code for at least C99 Standard compliance
dholmes
parents:
54937
diff
changeset
|
608 |
# This raises the language level for older 4.8 gcc, while lowering it for later |
98ed47cd114a
8224087: Compile C code for at least C99 Standard compliance
dholmes
parents:
54937
diff
changeset
|
609 |
# versions. clang and xlclang support the same flag. |
98ed47cd114a
8224087: Compile C code for at least C99 Standard compliance
dholmes
parents:
54937
diff
changeset
|
610 |
LANGSTD_CFLAGS="-std=c99" |
98ed47cd114a
8224087: Compile C code for at least C99 Standard compliance
dholmes
parents:
54937
diff
changeset
|
611 |
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
98ed47cd114a
8224087: Compile C code for at least C99 Standard compliance
dholmes
parents:
54937
diff
changeset
|
612 |
# We can't turn on -std=c99 without breaking compilation of the splashscreen/png |
98ed47cd114a
8224087: Compile C code for at least C99 Standard compliance
dholmes
parents:
54937
diff
changeset
|
613 |
# utilities. But we can enable c99 as below (previously achieved by using -Xa). |
98ed47cd114a
8224087: Compile C code for at least C99 Standard compliance
dholmes
parents:
54937
diff
changeset
|
614 |
# It is the no_lib that makes the difference. |
98ed47cd114a
8224087: Compile C code for at least C99 Standard compliance
dholmes
parents:
54937
diff
changeset
|
615 |
LANGSTD_CFLAGS="-xc99=all,no_lib" |
98ed47cd114a
8224087: Compile C code for at least C99 Standard compliance
dholmes
parents:
54937
diff
changeset
|
616 |
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then |
98ed47cd114a
8224087: Compile C code for at least C99 Standard compliance
dholmes
parents:
54937
diff
changeset
|
617 |
# MSVC doesn't support C99/C11 explicitly, unless you compile as C++: |
98ed47cd114a
8224087: Compile C code for at least C99 Standard compliance
dholmes
parents:
54937
diff
changeset
|
618 |
# LANGSTD_CFLAGS="/TP" |
98ed47cd114a
8224087: Compile C code for at least C99 Standard compliance
dholmes
parents:
54937
diff
changeset
|
619 |
# but that requires numerous changes to the sources files. So we are limited |
98ed47cd114a
8224087: Compile C code for at least C99 Standard compliance
dholmes
parents:
54937
diff
changeset
|
620 |
# to C89/C90 plus whatever extensions Visual Studio has decided to implement. |
98ed47cd114a
8224087: Compile C code for at least C99 Standard compliance
dholmes
parents:
54937
diff
changeset
|
621 |
# This is the lowest bar for shared code. |
98ed47cd114a
8224087: Compile C code for at least C99 Standard compliance
dholmes
parents:
54937
diff
changeset
|
622 |
LANGSTD_CFLAGS="" |
98ed47cd114a
8224087: Compile C code for at least C99 Standard compliance
dholmes
parents:
54937
diff
changeset
|
623 |
fi |
98ed47cd114a
8224087: Compile C code for at least C99 Standard compliance
dholmes
parents:
54937
diff
changeset
|
624 |
TOOLCHAIN_CFLAGS_JDK_CONLY="$LANGSTD_CFLAGS $TOOLCHAIN_CFLAGS_JDK_CONLY" |
98ed47cd114a
8224087: Compile C code for at least C99 Standard compliance
dholmes
parents:
54937
diff
changeset
|
625 |
|
49120 | 626 |
# CFLAGS WARNINGS STUFF |
627 |
# Set JVM_CFLAGS warning handling |
|
628 |
if test "x$TOOLCHAIN_TYPE" = xgcc; then |
|
56238 | 629 |
# JDK_DISABLED="-Wno-pointer-arith -Wno-undef -Wno-unused-function -Wno-unused-value -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-unused-label" |
630 |
# JVM_DISABLED="-Wno-unknown-pragmas -Wno-comment -Wno-delete-non-virtual-dtor -Wno-ignored-qualifiers -Wno-parentheses -Wno-reorder -Wno-unused-local-typedefs -Wno-unused-parameter -Wno-unused-variable -Wno-address -Wno-missing-field-initializers -Wno-unused-but-set-variable -Wno-char-subscripts -Wno-array-bounds -Wno-narrowing -Wno-empty-body -Wno-unused-but-set-parameter" |
|
56221 | 631 |
WARNING_CFLAGS_JDK="$WARNINGS_ENABLE_ALL $JDK_DISABLED" |
51853
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
632 |
WARNING_CFLAGS_JDK_CONLY="$WARNINGS_ENABLE_ALL_CFLAGS" |
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
633 |
WARNING_CFLAGS_JDK_CXXONLY="$WARNINGS_ENABLE_ALL_CXXFLAGS" |
56221 | 634 |
WARNING_CFLAGS_JVM="$WARNINGS_ENABLE_ALL $WARNINGS_ENABLE_ALL_CXXFLAGS $JVM_DISABLED" |
49120 | 635 |
|
636 |
elif test "x$TOOLCHAIN_TYPE" = xclang; then |
|
56900 | 637 |
WARNING_CFLAGS_JVM="-Wpointer-arith -Wsign-compare -Wunused-function -Wno-deprecated -Wreorder" |
49120 | 638 |
if test "x$OPENJDK_TARGET_OS" = xlinux; then |
639 |
WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wno-sometimes-uninitialized" |
|
640 |
WARNING_CFLAGS_JDK="-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2" |
|
641 |
fi |
|
642 |
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
|
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
643 |
WARNING_CFLAGS_JDK_CONLY="$WARNINGS_ENABLE_ALL_CFLAGS" |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
644 |
WARNING_CFLAGS_JDK_CXXONLY="$WARNINGS_ENABLE_ALL_CXXFLAGS" |
51853
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
645 |
WARNING_CFLAGS_JVM="$WARNINGS_ENABLE_ALL_CXXFLAGS" |
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
646 |
|
49120 | 647 |
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
648 |
WARNING_CFLAGS="$WARNINGS_ENABLE_ALL" |
56242
e60ee82dc0ce
Initial conversion for windows with -Wall and disables.
ihse
parents:
56240
diff
changeset
|
649 |
#WARNING_CFLAGS="-W3" |
e60ee82dc0ce
Initial conversion for windows with -Wall and disables.
ihse
parents:
56240
diff
changeset
|
650 |
#WARNING_CFLAGS_JDK="-wd4800" |
51853
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
651 |
|
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
652 |
elif test "x$TOOLCHAIN_TYPE" = xxlc; then |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
653 |
WARNING_CFLAGS="" # currently left empty |
49120 | 654 |
fi |
655 |
||
656 |
# Set some additional per-OS defines. |
|
657 |
||
658 |
# Additional macosx handling |
|
659 |
if test "x$OPENJDK_TARGET_OS" = xmacosx; then |
|
660 |
OS_CFLAGS="-DMAC_OS_X_VERSION_MIN_REQUIRED=$MACOSX_VERSION_MIN_NODOTS \ |
|
661 |
-mmacosx-version-min=$MACOSX_VERSION_MIN" |
|
662 |
||
663 |
if test -n "$MACOSX_VERSION_MAX"; then |
|
664 |
OS_CFLAGS="$OS_CFLAGS \ |
|
665 |
-DMAC_OS_X_VERSION_MAX_ALLOWED=$MACOSX_VERSION_MAX_NODOTS" |
|
666 |
fi |
|
667 |
fi |
|
668 |
||
669 |
# Where does this really belong?? |
|
670 |
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then |
|
671 |
PICFLAG="-fPIC" |
|
672 |
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
|
673 |
PICFLAG="-KPIC" |
|
674 |
elif test "x$TOOLCHAIN_TYPE" = xxlc; then |
|
675 |
# '-qpic' defaults to 'qpic=small'. This means that the compiler generates only |
|
676 |
# one instruction for accessing the TOC. If the TOC grows larger than 64K, the linker |
|
677 |
# will have to patch this single instruction with a call to some out-of-order code which |
|
50550
41ff671ed8cf
8204935: [aix] TOC overflow in libjvm.so (release build)
stuefe
parents:
49907
diff
changeset
|
678 |
# does the load from the TOC. This is of course slower, and we also would have |
49120 | 679 |
# to use '-bbigtoc' for linking anyway so we could also change the PICFLAG to 'qpic=large'. |
680 |
# With 'qpic=large' the compiler will by default generate a two-instruction sequence which |
|
681 |
# can be patched directly by the linker and does not require a jump to out-of-order code. |
|
50550
41ff671ed8cf
8204935: [aix] TOC overflow in libjvm.so (release build)
stuefe
parents:
49907
diff
changeset
|
682 |
# |
41ff671ed8cf
8204935: [aix] TOC overflow in libjvm.so (release build)
stuefe
parents:
49907
diff
changeset
|
683 |
# Since large TOC causes perf. overhead, only pay it where we must. Currently this is |
41ff671ed8cf
8204935: [aix] TOC overflow in libjvm.so (release build)
stuefe
parents:
49907
diff
changeset
|
684 |
# for all libjvm variants (both gtest and normal) but no other binaries. So, build |
41ff671ed8cf
8204935: [aix] TOC overflow in libjvm.so (release build)
stuefe
parents:
49907
diff
changeset
|
685 |
# libjvm with -qpic=large and link with -bbigtoc. |
41ff671ed8cf
8204935: [aix] TOC overflow in libjvm.so (release build)
stuefe
parents:
49907
diff
changeset
|
686 |
JVM_PICFLAG="-qpic=large" |
41ff671ed8cf
8204935: [aix] TOC overflow in libjvm.so (release build)
stuefe
parents:
49907
diff
changeset
|
687 |
JDK_PICFLAG="-qpic" |
49120 | 688 |
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then |
689 |
PICFLAG="" |
|
690 |
fi |
|
691 |
||
50550
41ff671ed8cf
8204935: [aix] TOC overflow in libjvm.so (release build)
stuefe
parents:
49907
diff
changeset
|
692 |
if test "x$TOOLCHAIN_TYPE" != xxlc; then |
41ff671ed8cf
8204935: [aix] TOC overflow in libjvm.so (release build)
stuefe
parents:
49907
diff
changeset
|
693 |
JVM_PICFLAG="$PICFLAG" |
41ff671ed8cf
8204935: [aix] TOC overflow in libjvm.so (release build)
stuefe
parents:
49907
diff
changeset
|
694 |
JDK_PICFLAG="$PICFLAG" |
41ff671ed8cf
8204935: [aix] TOC overflow in libjvm.so (release build)
stuefe
parents:
49907
diff
changeset
|
695 |
fi |
49120 | 696 |
|
697 |
if test "x$OPENJDK_TARGET_OS" = xmacosx; then |
|
698 |
# Linking is different on MacOSX |
|
699 |
JDK_PICFLAG='' |
|
700 |
if test "x$STATIC_BUILD" = xtrue; then |
|
701 |
JVM_PICFLAG="" |
|
702 |
fi |
|
703 |
fi |
|
704 |
||
705 |
# Optional POSIX functionality needed by the JVM |
|
706 |
# |
|
707 |
# Check if clock_gettime is available and in which library. This indicates |
|
708 |
# availability of CLOCK_MONOTONIC for hotspot. But we don't need to link, so |
|
709 |
# don't let it update LIBS. |
|
710 |
save_LIBS="$LIBS" |
|
711 |
AC_SEARCH_LIBS(clock_gettime, rt, [HAS_CLOCK_GETTIME=true], []) |
|
712 |
if test "x$LIBS" = "x-lrt "; then |
|
713 |
CLOCK_GETTIME_IN_LIBRT=true |
|
714 |
fi |
|
715 |
LIBS="$save_LIBS" |
|
716 |
||
717 |
if test "x$HAS_CLOCK_GETTIME" = "xtrue"; then |
|
718 |
OS_CFLAGS_JVM="$OS_CFLAGS_JVM -DSUPPORTS_CLOCK_MONOTONIC" |
|
719 |
if test "x$CLOCK_GETTIME_IN_LIBRT" = "xtrue"; then |
|
720 |
OS_CFLAGS_JVM="$OS_CFLAGS_JVM -DNEEDS_LIBRT" |
|
721 |
fi |
|
722 |
fi |
|
723 |
]) |
|
724 |
||
725 |
################################################################################ |
|
726 |
# $1 - Either BUILD or TARGET to pick the correct OS/CPU variables to check |
|
727 |
# conditionals against. |
|
728 |
# $2 - Optional prefix for each variable defined. |
|
53643
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
729 |
# $3 - Optional prefix for compiler variables (either BUILD_ or nothing). |
49120 | 730 |
AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP], |
731 |
[ |
|
732 |
#### CPU DEFINES, these should (in theory) be independent on toolchain |
|
733 |
||
734 |
# Setup target CPU |
|
735 |
# Setup endianness |
|
736 |
if test "x$FLAGS_CPU_ENDIAN" = xlittle; then |
|
737 |
$1_DEFINES_CPU_JVM="-DVM_LITTLE_ENDIAN" |
|
738 |
fi |
|
739 |
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
|
740 |
# The macro _LITTLE_ENDIAN needs to be defined the same to avoid the |
|
741 |
# Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN |
|
742 |
if test "x$FLAGS_CPU_ENDIAN" = xlittle; then |
|
743 |
$1_DEFINES_CPU_JDK="-D_LITTLE_ENDIAN=" |
|
744 |
else |
|
745 |
$1_DEFINES_CPU_JDK="-D_BIG_ENDIAN=" |
|
746 |
fi |
|
747 |
else |
|
748 |
if test "x$FLAGS_CPU_ENDIAN" = xlittle; then |
|
749 |
$1_DEFINES_CPU_JDK="-D_LITTLE_ENDIAN" |
|
750 |
else |
|
751 |
$1_DEFINES_CPU_JDK="-D_BIG_ENDIAN" |
|
752 |
fi |
|
753 |
fi |
|
754 |
||
755 |
# setup CPU bit size |
|
756 |
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -DARCH='\"$FLAGS_CPU_LEGACY\"' \ |
|
757 |
-D$FLAGS_CPU_LEGACY" |
|
758 |
||
759 |
if test "x$FLAGS_CPU_BITS" = x64; then |
|
760 |
# -D_LP64=1 is only set on linux and mac. Setting on windows causes diff in |
|
761 |
# unpack200.exe. |
|
762 |
if test "x$FLAGS_OS" = xlinux || test "x$FLAGS_OS" = xmacosx; then |
|
763 |
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_LP64=1" |
|
764 |
fi |
|
765 |
if test "x$FLAGS_OS" != xsolaris && test "x$FLAGS_OS" != xaix; then |
|
766 |
# Solaris does not have _LP64=1 in the old build. |
|
767 |
# xlc on AIX defines _LP64=1 by default and issues a warning if we redefine it. |
|
768 |
$1_DEFINES_CPU_JVM="${$1_DEFINES_CPU_JVM} -D_LP64=1" |
|
769 |
fi |
|
770 |
fi |
|
771 |
||
772 |
# toolchain dependend, per-cpu |
|
773 |
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
|
774 |
if test "x$FLAGS_CPU_ARCH" = xx86; then |
|
775 |
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -DcpuIntel -Di586 -D$FLAGS_CPU_LEGACY_LIB" |
|
776 |
fi |
|
777 |
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then |
|
778 |
if test "x$FLAGS_CPU" = xx86_64; then |
|
779 |
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_AMD64_ -Damd64" |
|
780 |
else |
|
781 |
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_X86_ -Dx86" |
|
782 |
fi |
|
783 |
fi |
|
784 |
||
785 |
# CFLAGS PER CPU |
|
786 |
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then |
|
787 |
# COMMON to gcc and clang |
|
788 |
if test "x$FLAGS_CPU" = xx86; then |
|
789 |
# Force compatibility with i586 on 32 bit intel platforms. |
|
790 |
$1_CFLAGS_CPU="-march=i586" |
|
791 |
fi |
|
792 |
fi |
|
793 |
||
794 |
if test "x$TOOLCHAIN_TYPE" = xgcc; then |
|
795 |
if test "x$FLAGS_CPU" = xarm; then |
|
796 |
# -Wno-psabi to get rid of annoying "note: the mangling of 'va_list' has changed in GCC 4.4" |
|
797 |
$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)\"'" |
|
798 |
$1_CFLAGS_CPU_JVM="-DARM" |
|
799 |
elif test "x$FLAGS_CPU_ARCH" = xppc; then |
|
800 |
$1_CFLAGS_CPU_JVM="-minsert-sched-nops=regroup_exact -mno-multiple -mno-string" |
|
801 |
if test "x$FLAGS_CPU" = xppc64; then |
|
802 |
# -mminimal-toc fixes `relocation truncated to fit' error for gcc 4.1. |
|
803 |
# Use ppc64 instructions, but schedule for power5 |
|
804 |
$1_CFLAGS_CPU_JVM="${$1_CFLAGS_CPU_JVM} -mminimal-toc -mcpu=powerpc64 -mtune=power5" |
|
805 |
elif test "x$FLAGS_CPU" = xppc64le; then |
|
806 |
# Little endian machine uses ELFv2 ABI. |
|
807 |
# Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI. |
|
808 |
$1_CFLAGS_CPU_JVM="${$1_CFLAGS_CPU_JVM} -DABI_ELFv2 -mcpu=power8 -mtune=power8" |
|
809 |
fi |
|
810 |
elif test "x$FLAGS_CPU" = xs390x; then |
|
811 |
$1_CFLAGS_CPU="-mbackchain -march=z10" |
|
812 |
fi |
|
813 |
||
814 |
if test "x$FLAGS_CPU_ARCH" != xarm && test "x$FLAGS_CPU_ARCH" != xppc; then |
|
815 |
# for all archs except arm and ppc, prevent gcc to omit frame pointer |
|
816 |
$1_CFLAGS_CPU_JDK="${$1_CFLAGS_CPU_JDK} -fno-omit-frame-pointer" |
|
817 |
fi |
|
818 |
||
53643
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
819 |
$1_CXXSTD_CXXFLAG="-std=gnu++98" |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
820 |
FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${$1_CXXSTD_CXXFLAG} -Werror], |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
821 |
PREFIX: $3, IF_FALSE: [$1_CXXSTD_CXXFLAG=""]) |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
822 |
$1_TOOLCHAIN_CFLAGS_JDK_CXXONLY="${$1_CXXSTD_CXXFLAG}" |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
823 |
$1_TOOLCHAIN_CFLAGS_JVM="${$1_TOOLCHAIN_CFLAGS_JVM} ${$1_CXXSTD_CXXFLAG}" |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
824 |
$2ADLC_CXXFLAG="${$1_CXXSTD_CXXFLAG}" |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
825 |
|
49120 | 826 |
elif test "x$TOOLCHAIN_TYPE" = xclang; then |
827 |
if test "x$FLAGS_OS" = xlinux; then |
|
828 |
# ppc test not really needed for clang |
|
829 |
if test "x$FLAGS_CPU_ARCH" != xarm && test "x$FLAGS_CPU_ARCH" != xppc; then |
|
830 |
# for all archs except arm and ppc, prevent gcc to omit frame pointer |
|
831 |
$1_CFLAGS_CPU_JDK="${$1_CFLAGS_CPU_JDK} -fno-omit-frame-pointer" |
|
832 |
fi |
|
833 |
fi |
|
834 |
||
835 |
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
|
836 |
if test "x$FLAGS_CPU" = xx86_64; then |
|
837 |
# NOTE: -xregs=no%frameptr is supposed to be default on x64 |
|
838 |
$1_CFLAGS_CPU_JDK="-xregs=no%frameptr" |
|
839 |
elif test "x$FLAGS_CPU" = xsparcv9; then |
|
840 |
$1_CFLAGS_CPU_JVM="-xarch=sparc" |
|
841 |
$1_CFLAGS_CPU_JDK_LIBONLY="-xregs=no%appl" |
|
842 |
fi |
|
843 |
||
844 |
elif test "x$TOOLCHAIN_TYPE" = xxlc; then |
|
845 |
if test "x$FLAGS_CPU" = xppc64; then |
|
846 |
$1_CFLAGS_CPU_JVM="-qarch=ppc64" |
|
847 |
fi |
|
848 |
||
849 |
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then |
|
850 |
if test "x$FLAGS_CPU" = xx86; then |
|
851 |
$1_CFLAGS_CPU_JVM="-arch:IA32" |
|
852 |
elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then |
|
853 |
if test "x$DEBUG_LEVEL" != xrelease; then |
|
854 |
# NOTE: This is probably redundant; -homeparams is default on |
|
855 |
# non-release builds. |
|
856 |
$1_CFLAGS_CPU_JVM="-homeparams" |
|
857 |
fi |
|
858 |
fi |
|
859 |
fi |
|
860 |
||
861 |
if test "x$TOOLCHAIN_TYPE" = xgcc; then |
|
53643
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
862 |
FLAGS_SETUP_GCC6_COMPILER_FLAGS($1, $3) |
49120 | 863 |
$1_TOOLCHAIN_CFLAGS="${$1_GCC6_CFLAGS}" |
864 |
||
49200 | 865 |
$1_WARNING_CFLAGS_JVM="-Wno-format-zero-length -Wtype-limits -Wuninitialized" |
49120 | 866 |
fi |
867 |
||
54490
bf07e140c49c
8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
erikj
parents:
53837
diff
changeset
|
868 |
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then |
bf07e140c49c
8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
erikj
parents:
53837
diff
changeset
|
869 |
# Check if compiler supports -fmacro-prefix-map. If so, use that to make |
bf07e140c49c
8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
erikj
parents:
53837
diff
changeset
|
870 |
# the __FILE__ macro resolve to paths relative to the workspace root. |
bf07e140c49c
8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
erikj
parents:
53837
diff
changeset
|
871 |
workspace_root_trailing_slash="${WORKSPACE_ROOT%/}/" |
bf07e140c49c
8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
erikj
parents:
53837
diff
changeset
|
872 |
FILE_MACRO_CFLAGS="-fmacro-prefix-map=${workspace_root_trailing_slash}=" |
bf07e140c49c
8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
erikj
parents:
53837
diff
changeset
|
873 |
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${FILE_MACRO_CFLAGS}], |
bf07e140c49c
8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
erikj
parents:
53837
diff
changeset
|
874 |
PREFIX: $3, |
bf07e140c49c
8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
erikj
parents:
53837
diff
changeset
|
875 |
IF_FALSE: [ |
bf07e140c49c
8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
erikj
parents:
53837
diff
changeset
|
876 |
FILE_MACRO_CFLAGS= |
bf07e140c49c
8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
erikj
parents:
53837
diff
changeset
|
877 |
] |
bf07e140c49c
8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
erikj
parents:
53837
diff
changeset
|
878 |
) |
bf07e140c49c
8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
erikj
parents:
53837
diff
changeset
|
879 |
fi |
bf07e140c49c
8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
erikj
parents:
53837
diff
changeset
|
880 |
|
49120 | 881 |
# EXPORT to API |
53643
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
882 |
CFLAGS_JVM_COMMON="$ALWAYS_CFLAGS_JVM $ALWAYS_DEFINES_JVM \ |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
883 |
$TOOLCHAIN_CFLAGS_JVM ${$1_TOOLCHAIN_CFLAGS_JVM} \ |
49120 | 884 |
$OS_CFLAGS $OS_CFLAGS_JVM $CFLAGS_OS_DEF_JVM $DEBUG_CFLAGS_JVM \ |
54490
bf07e140c49c
8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
erikj
parents:
53837
diff
changeset
|
885 |
$WARNING_CFLAGS $WARNING_CFLAGS_JVM $JVM_PICFLAG $FILE_MACRO_CFLAGS" |
49120 | 886 |
|
887 |
CFLAGS_JDK_COMMON="$ALWAYS_CFLAGS_JDK $ALWAYS_DEFINES_JDK $TOOLCHAIN_CFLAGS_JDK \ |
|
888 |
$OS_CFLAGS $CFLAGS_OS_DEF_JDK $DEBUG_CFLAGS_JDK $DEBUG_OPTIONS_FLAGS_JDK \ |
|
54490
bf07e140c49c
8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
erikj
parents:
53837
diff
changeset
|
889 |
$WARNING_CFLAGS $WARNING_CFLAGS_JDK $DEBUG_SYMBOLS_CFLAGS_JDK \ |
bf07e140c49c
8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
erikj
parents:
53837
diff
changeset
|
890 |
$FILE_MACRO_CFLAGS" |
49120 | 891 |
|
892 |
# Use ${$2EXTRA_CFLAGS} to block EXTRA_CFLAGS to be added to build flags. |
|
893 |
# (Currently we don't have any OPENJDK_BUILD_EXTRA_CFLAGS, but that might |
|
894 |
# change in the future.) |
|
895 |
||
49155
7cd937277d5e
8199338: Use -g0 on solstudio also for compiling C programs
ihse
parents:
49120
diff
changeset
|
896 |
CFLAGS_JDK_COMMON_CONLY="$TOOLCHAIN_CFLAGS_JDK_CONLY \ |
49120 | 897 |
$WARNING_CFLAGS_JDK_CONLY ${$2EXTRA_CFLAGS}" |
53643
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
898 |
CFLAGS_JDK_COMMON_CXXONLY="$ALWAYS_DEFINES_JDK_CXXONLY \ |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
899 |
$TOOLCHAIN_CFLAGS_JDK_CXXONLY \ |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
900 |
${$1_TOOLCHAIN_CFLAGS_JDK_CXXONLY} \ |
49155
7cd937277d5e
8199338: Use -g0 on solstudio also for compiling C programs
ihse
parents:
49120
diff
changeset
|
901 |
$WARNING_CFLAGS_JDK_CXXONLY ${$2EXTRA_CXXFLAGS}" |
49120 | 902 |
|
903 |
$1_CFLAGS_JVM="${$1_DEFINES_CPU_JVM} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JVM} ${$1_TOOLCHAIN_CFLAGS} ${$1_WARNING_CFLAGS_JVM}" |
|
904 |
$1_CFLAGS_JDK="${$1_DEFINES_CPU_JDK} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JDK} ${$1_TOOLCHAIN_CFLAGS}" |
|
905 |
||
906 |
$2JVM_CFLAGS="$CFLAGS_JVM_COMMON ${$1_CFLAGS_JVM} ${$2EXTRA_CXXFLAGS}" |
|
907 |
||
908 |
$2CFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CONLY ${$1_CFLAGS_JDK}" |
|
909 |
$2CXXFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CXXONLY ${$1_CFLAGS_JDK}" |
|
910 |
$2CFLAGS_JDKLIB="${$2CFLAGS_JDKEXE} $JDK_PICFLAG ${$1_CFLAGS_CPU_JDK_LIBONLY}" |
|
911 |
$2CXXFLAGS_JDKLIB="${$2CXXFLAGS_JDKEXE} $JDK_PICFLAG ${$1_CFLAGS_CPU_JDK_LIBONLY}" |
|
912 |
||
913 |
AC_SUBST($2JVM_CFLAGS) |
|
914 |
AC_SUBST($2CFLAGS_JDKLIB) |
|
915 |
AC_SUBST($2CFLAGS_JDKEXE) |
|
916 |
AC_SUBST($2CXXFLAGS_JDKLIB) |
|
917 |
AC_SUBST($2CXXFLAGS_JDKEXE) |
|
53643
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
918 |
AC_SUBST($2ADLC_CXXFLAG) |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
919 |
|
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
920 |
COMPILER_FP_CONTRACT_OFF_FLAG="-ffp-contract=off" |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
921 |
# Check that the compiler supports -ffp-contract=off flag |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
922 |
# Set FDLIBM_CFLAGS to -ffp-contract=off if it does. Empty |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
923 |
# otherwise. |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
924 |
# These flags are required for GCC-based builds of |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
925 |
# fdlibm with optimization without losing precision. |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
926 |
# Notably, -ffp-contract=off needs to be added for GCC >= 4.6. |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
927 |
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
928 |
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${COMPILER_FP_CONTRACT_OFF_FLAG}], |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
929 |
PREFIX: $3, |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
930 |
IF_TRUE: [$2FDLIBM_CFLAGS=${COMPILER_FP_CONTRACT_OFF_FLAG}], |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
931 |
IF_FALSE: [$2FDLIBM_CFLAGS=""]) |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
932 |
fi |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
933 |
AC_SUBST($2FDLIBM_CFLAGS) |
49120 | 934 |
]) |
935 |
||
936 |
# FLAGS_SETUP_GCC6_COMPILER_FLAGS([PREFIX]) |
|
937 |
# Arguments: |
|
938 |
# $1 - Prefix for each variable defined. |
|
53643
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
939 |
# $2 - Prefix for compiler variables (either BUILD_ or nothing). |
49120 | 940 |
AC_DEFUN([FLAGS_SETUP_GCC6_COMPILER_FLAGS], |
941 |
[ |
|
942 |
# These flags are required for GCC 6 builds as undefined behaviour in OpenJDK code |
|
943 |
# runs afoul of the more aggressive versions of these optimisations. |
|
944 |
# Notably, value range propagation now assumes that the this pointer of C++ |
|
945 |
# member functions is non-null. |
|
946 |
NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks" |
|
53643
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
947 |
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror], |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
948 |
PREFIX: $2, IF_FALSE: [NO_DELETE_NULL_POINTER_CHECKS_CFLAG=""]) |
49120 | 949 |
NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse" |
53643
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
950 |
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_LIFETIME_DSE_CFLAG -Werror], |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
951 |
PREFIX: $2, IF_FALSE: [NO_LIFETIME_DSE_CFLAG=""]) |
49120 | 952 |
$1_GCC6_CFLAGS="${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}" |
953 |
]) |
|
954 |
||
955 |
# Documentation on common flags used for solstudio in HIGHEST. |
|
956 |
# |
|
957 |
# WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be |
|
958 |
# done with care, there are some assumptions below that need to |
|
959 |
# be understood about the use of pointers, and IEEE behavior. |
|
960 |
# |
|
961 |
# -fns: Use non-standard floating point mode (not IEEE 754) |
|
962 |
# -fsimple: Do some simplification of floating point arithmetic (not IEEE 754) |
|
963 |
# -fsingle: Use single precision floating point with 'float' |
|
964 |
# -xalias_level=basic: Assume memory references via basic pointer types do not alias |
|
965 |
# (Source with excessing pointer casting and data access with mixed |
|
966 |
# pointer types are not recommended) |
|
967 |
# -xbuiltin=%all: Use intrinsic or inline versions for math/std functions |
|
968 |
# (If you expect perfect errno behavior, do not use this) |
|
969 |
# -xdepend: Loop data dependency optimizations (need -xO3 or higher) |
|
970 |
# -xrestrict: Pointer parameters to functions do not overlap |
|
971 |
# (Similar to -xalias_level=basic usage, but less obvious sometimes. |
|
972 |
# If you pass in multiple pointers to the same data, do not use this) |
|
973 |
# -xlibmil: Inline some library routines |
|
974 |
# (If you expect perfect errno behavior, do not use this) |
|
975 |
# -xlibmopt: Use optimized math routines (CURRENTLY DISABLED) |
|
976 |
# (If you expect perfect errno behavior, do not use this) |
|
977 |
# Can cause undefined external on Solaris 8 X86 on __sincos, removing for now |