author | mbaesken |
Tue, 14 May 2019 10:21:55 +0200 | |
changeset 54937 | 7e5e0b326ed7 |
parent 54711 | 297ddf282627 |
child 54999 | 98ed47cd114a |
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 |
53837
b3f6ffbedd68
8218965: aix: support xlclang++ in the compiler detection
mbaesken
parents:
53643
diff
changeset
|
124 |
if test "x$XLC_USES_CLANG" = xtrue; then |
b3f6ffbedd68
8218965: aix: support xlclang++ in the compiler detection
mbaesken
parents:
53643
diff
changeset
|
125 |
CFLAGS_DEBUG_SYMBOLS="-g1" |
b3f6ffbedd68
8218965: aix: support xlclang++ in the compiler detection
mbaesken
parents:
53643
diff
changeset
|
126 |
else |
b3f6ffbedd68
8218965: aix: support xlclang++ in the compiler detection
mbaesken
parents:
53643
diff
changeset
|
127 |
CFLAGS_DEBUG_SYMBOLS="-g" |
b3f6ffbedd68
8218965: aix: support xlclang++ in the compiler detection
mbaesken
parents:
53643
diff
changeset
|
128 |
fi |
49120 | 129 |
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
|
130 |
CFLAGS_DEBUG_SYMBOLS="-Z7 -d2Zi+" |
49120 | 131 |
fi |
132 |
||
133 |
AC_SUBST(CFLAGS_DEBUG_SYMBOLS) |
|
51095 | 134 |
AC_SUBST(ASFLAGS_DEBUG_SYMBOLS) |
49120 | 135 |
]) |
136 |
||
137 |
AC_DEFUN([FLAGS_SETUP_WARNINGS], |
|
138 |
[ |
|
139 |
AC_ARG_ENABLE([warnings-as-errors], [AS_HELP_STRING([--disable-warnings-as-errors], |
|
140 |
[do not consider native warnings to be an error @<:@enabled@:>@])]) |
|
141 |
||
49907
1ca3406a2101
8202325: [aix] disable warnings-as-errors by default
stuefe
parents:
49726
diff
changeset
|
142 |
# Set default value. |
1ca3406a2101
8202325: [aix] disable warnings-as-errors by default
stuefe
parents:
49726
diff
changeset
|
143 |
if test "x$TOOLCHAIN_TYPE" = xxlc; then |
1ca3406a2101
8202325: [aix] disable warnings-as-errors by default
stuefe
parents:
49726
diff
changeset
|
144 |
WARNINGS_AS_ERRORS=false |
1ca3406a2101
8202325: [aix] disable warnings-as-errors by default
stuefe
parents:
49726
diff
changeset
|
145 |
else |
1ca3406a2101
8202325: [aix] disable warnings-as-errors by default
stuefe
parents:
49726
diff
changeset
|
146 |
WARNINGS_AS_ERRORS=true |
1ca3406a2101
8202325: [aix] disable warnings-as-errors by default
stuefe
parents:
49726
diff
changeset
|
147 |
fi |
1ca3406a2101
8202325: [aix] disable warnings-as-errors by default
stuefe
parents:
49726
diff
changeset
|
148 |
|
49120 | 149 |
AC_MSG_CHECKING([if native warnings are errors]) |
150 |
if test "x$enable_warnings_as_errors" = "xyes"; then |
|
151 |
AC_MSG_RESULT([yes (explicitly set)]) |
|
152 |
WARNINGS_AS_ERRORS=true |
|
153 |
elif test "x$enable_warnings_as_errors" = "xno"; then |
|
49907
1ca3406a2101
8202325: [aix] disable warnings-as-errors by default
stuefe
parents:
49726
diff
changeset
|
154 |
AC_MSG_RESULT([no (explicitly set)]) |
49120 | 155 |
WARNINGS_AS_ERRORS=false |
156 |
elif test "x$enable_warnings_as_errors" = "x"; then |
|
49907
1ca3406a2101
8202325: [aix] disable warnings-as-errors by default
stuefe
parents:
49726
diff
changeset
|
157 |
AC_MSG_RESULT([${WARNINGS_AS_ERRORS} (default)]) |
49120 | 158 |
else |
159 |
AC_MSG_ERROR([--enable-warnings-as-errors accepts no argument]) |
|
160 |
fi |
|
161 |
||
162 |
AC_SUBST(WARNINGS_AS_ERRORS) |
|
163 |
||
164 |
case "${TOOLCHAIN_TYPE}" in |
|
165 |
microsoft) |
|
166 |
DISABLE_WARNING_PREFIX="-wd" |
|
167 |
CFLAGS_WARNINGS_ARE_ERRORS="-WX" |
|
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
168 |
|
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
169 |
WARNINGS_ENABLE_ALL="-W3" |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
170 |
DISABLED_WARNINGS="4800" |
49120 | 171 |
;; |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
172 |
|
49120 | 173 |
solstudio) |
174 |
DISABLE_WARNING_PREFIX="-erroff=" |
|
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
175 |
CFLAGS_WARNINGS_ARE_ERRORS="-errwarn=%all" |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
176 |
|
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
177 |
WARNINGS_ENABLE_ALL_CFLAGS="-v" |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
178 |
WARNINGS_ENABLE_ALL_CXXFLAGS="+w" |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
179 |
|
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
180 |
DISABLED_WARNINGS_C="" |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
181 |
DISABLED_WARNINGS_CXX="" |
49120 | 182 |
;; |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
183 |
|
49120 | 184 |
gcc) |
49200 | 185 |
DISABLE_WARNING_PREFIX="-Wno-" |
49120 | 186 |
CFLAGS_WARNINGS_ARE_ERRORS="-Werror" |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
187 |
|
51853
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
188 |
# 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
|
189 |
WARNINGS_ENABLE_ADDITIONAL="-Wpointer-arith -Wsign-compare \ |
53174 | 190 |
-Wunused-function -Wundef -Wunused-value -Wreturn-type \ |
191 |
-Wtrampolines" |
|
51853
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
192 |
WARNINGS_ENABLE_ADDITIONAL_CXX="-Woverloaded-virtual -Wreorder" |
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
193 |
WARNINGS_ENABLE_ALL_CFLAGS="-Wall -Wextra -Wformat=2 $WARNINGS_ENABLE_ADDITIONAL" |
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
194 |
WARNINGS_ENABLE_ALL_CXXFLAGS="$WARNINGS_ENABLE_ALL_CFLAGS $WARNINGS_ENABLE_ADDITIONAL_CXX" |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
195 |
|
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
196 |
DISABLED_WARNINGS="unused-parameter unused" |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
197 |
|
49120 | 198 |
# Repeate the check for the BUILD_CC and BUILD_CXX. Need to also reset |
199 |
# CFLAGS since any target specific flags will likely not work with the |
|
200 |
# build compiler |
|
201 |
CC_OLD="$CC" |
|
202 |
CXX_OLD="$CXX" |
|
203 |
CC="$BUILD_CC" |
|
204 |
CXX="$BUILD_CXX" |
|
205 |
CFLAGS_OLD="$CFLAGS" |
|
206 |
CFLAGS="" |
|
49200 | 207 |
BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-" |
49120 | 208 |
CC="$CC_OLD" |
209 |
CXX="$CXX_OLD" |
|
210 |
CFLAGS="$CFLAGS_OLD" |
|
211 |
;; |
|
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
212 |
|
49120 | 213 |
clang) |
214 |
DISABLE_WARNING_PREFIX="-Wno-" |
|
215 |
CFLAGS_WARNINGS_ARE_ERRORS="-Werror" |
|
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
216 |
|
51853
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
217 |
# 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
|
218 |
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
|
219 |
-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
|
220 |
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
|
221 |
|
54711
297ddf282627
8223309: test failing due to self-assign-overloaded
erikj
parents:
54646
diff
changeset
|
222 |
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
|
223 |
|
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
224 |
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
|
225 |
# 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
|
226 |
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
|
227 |
fi |
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
228 |
|
49120 | 229 |
;; |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
230 |
|
49120 | 231 |
xlc) |
232 |
DISABLE_WARNING_PREFIX="-qsuppress=" |
|
233 |
CFLAGS_WARNINGS_ARE_ERRORS="-qhalt=w" |
|
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
234 |
|
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
235 |
# 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
|
236 |
WARNINGS_ENABLE_ALL="-qinfo=all -qformat=all" |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
237 |
DISABLED_WARNINGS="" |
49120 | 238 |
;; |
239 |
esac |
|
240 |
AC_SUBST(DISABLE_WARNING_PREFIX) |
|
241 |
AC_SUBST(BUILD_CC_DISABLE_WARNING_PREFIX) |
|
242 |
AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS) |
|
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
243 |
AC_SUBST(DISABLED_WARNINGS) |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
244 |
AC_SUBST(DISABLED_WARNINGS_C) |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
245 |
AC_SUBST(DISABLED_WARNINGS_CXX) |
49120 | 246 |
]) |
247 |
||
248 |
AC_DEFUN([FLAGS_SETUP_QUALITY_CHECKS], |
|
249 |
[ |
|
250 |
# bounds, memory and behavior checking options |
|
251 |
if test "x$TOOLCHAIN_TYPE" = xgcc; then |
|
252 |
case $DEBUG_LEVEL in |
|
253 |
release ) |
|
254 |
# no adjustment |
|
255 |
;; |
|
256 |
fastdebug ) |
|
257 |
# no adjustment |
|
258 |
;; |
|
259 |
slowdebug ) |
|
260 |
# FIXME: By adding this to C(XX)FLAGS_DEBUG_OPTIONS/JVM_CFLAGS_SYMBOLS it |
|
261 |
# get's added conditionally on whether we produce debug symbols or not. |
|
262 |
# This is most likely not really correct. |
|
263 |
||
264 |
# Add runtime stack smashing and undefined behavior checks. |
|
49200 | 265 |
CFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param ssp-buffer-size=1" |
266 |
CXXFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param ssp-buffer-size=1" |
|
49120 | 267 |
|
49200 | 268 |
JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -fstack-protector-all --param ssp-buffer-size=1" |
49120 | 269 |
;; |
270 |
esac |
|
271 |
fi |
|
272 |
]) |
|
273 |
||
274 |
AC_DEFUN([FLAGS_SETUP_OPTIMIZATION], |
|
275 |
[ |
|
276 |
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
|
277 |
CC_HIGHEST="-fns -fsimple -fsingle -xbuiltin=%all -xdepend -xrestrict -xlibmil" |
|
278 |
||
279 |
C_O_FLAG_HIGHEST_JVM="-xO4" |
|
280 |
C_O_FLAG_DEBUG_JVM="" |
|
281 |
C_O_FLAG_SIZE="" |
|
282 |
C_O_FLAG_DEBUG="" |
|
283 |
C_O_FLAG_NONE="" |
|
284 |
if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then |
|
285 |
C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST" |
|
286 |
C_O_FLAG_HI="-xO4 -Wu,-O4~yz" |
|
287 |
C_O_FLAG_NORM="-xO2 -Wu,-O2~yz" |
|
288 |
elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then |
|
289 |
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
|
290 |
-xprefetch=auto,explicit $CC_HIGHEST" |
49120 | 291 |
C_O_FLAG_HI="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0" |
292 |
C_O_FLAG_NORM="-xO2 -Wc,-Qrm-s -Wc,-Qiselect-T0" |
|
293 |
fi |
|
294 |
elif test "x$TOOLCHAIN_TYPE" = xgcc; then |
|
295 |
C_O_FLAG_HIGHEST_JVM="-O3" |
|
296 |
C_O_FLAG_HIGHEST="-O3" |
|
297 |
C_O_FLAG_HI="-O3" |
|
298 |
C_O_FLAG_NORM="-O2" |
|
299 |
C_O_FLAG_SIZE="-Os" |
|
300 |
C_O_FLAG_DEBUG="-O0" |
|
301 |
C_O_FLAG_DEBUG_JVM="-O0" |
|
302 |
C_O_FLAG_NONE="-O0" |
|
54937
7e5e0b326ed7
8130017: use _FORTIFY_SOURCE in gcc fastdebug builds
mbaesken
parents:
54711
diff
changeset
|
303 |
# -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
|
304 |
# 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
|
305 |
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
|
306 |
ENABLE_FORTIFY_CFLAGS="-D_FORTIFY_SOURCE=2" |
7e5e0b326ed7
8130017: use _FORTIFY_SOURCE in gcc fastdebug builds
mbaesken
parents:
54711
diff
changeset
|
307 |
DISABLE_FORTIFY_CFLAGS="-U_FORTIFY_SOURCE" |
7e5e0b326ed7
8130017: use _FORTIFY_SOURCE in gcc fastdebug builds
mbaesken
parents:
54711
diff
changeset
|
308 |
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
|
309 |
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
|
310 |
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
|
311 |
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
|
312 |
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
|
313 |
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
|
314 |
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
|
315 |
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
|
316 |
fi |
49120 | 317 |
elif test "x$TOOLCHAIN_TYPE" = xclang; then |
318 |
if test "x$OPENJDK_TARGET_OS" = xmacosx; then |
|
319 |
# On MacOSX we optimize for size, something |
|
320 |
# we should do for all platforms? |
|
321 |
C_O_FLAG_HIGHEST_JVM="-Os" |
|
322 |
C_O_FLAG_HIGHEST="-Os" |
|
323 |
C_O_FLAG_HI="-Os" |
|
324 |
C_O_FLAG_NORM="-Os" |
|
325 |
C_O_FLAG_DEBUG_JVM="" |
|
326 |
else |
|
327 |
C_O_FLAG_HIGHEST_JVM="-O3" |
|
328 |
C_O_FLAG_HIGHEST="-O3" |
|
329 |
C_O_FLAG_HI="-O3" |
|
330 |
C_O_FLAG_NORM="-O2" |
|
331 |
C_O_FLAG_DEBUG_JVM="-O0" |
|
332 |
fi |
|
333 |
C_O_FLAG_SIZE="-Os" |
|
334 |
C_O_FLAG_DEBUG="-O0" |
|
335 |
C_O_FLAG_NONE="-O0" |
|
336 |
elif test "x$TOOLCHAIN_TYPE" = xxlc; then |
|
337 |
C_O_FLAG_HIGHEST_JVM="-O3 -qhot=level=1 -qinline -qinlglue" |
|
338 |
C_O_FLAG_HIGHEST="-O3 -qhot=level=1 -qinline -qinlglue" |
|
339 |
C_O_FLAG_HI="-O3 -qinline -qinlglue" |
|
340 |
C_O_FLAG_NORM="-O2" |
|
341 |
C_O_FLAG_DEBUG="-qnoopt" |
|
342 |
# FIXME: Value below not verified. |
|
343 |
C_O_FLAG_DEBUG_JVM="" |
|
344 |
C_O_FLAG_NONE="-qnoopt" |
|
345 |
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then |
|
346 |
C_O_FLAG_HIGHEST_JVM="-O2 -Oy-" |
|
347 |
C_O_FLAG_HIGHEST="-O2" |
|
348 |
C_O_FLAG_HI="-O1" |
|
349 |
C_O_FLAG_NORM="-O1" |
|
350 |
C_O_FLAG_DEBUG="-Od" |
|
351 |
C_O_FLAG_DEBUG_JVM="" |
|
352 |
C_O_FLAG_NONE="-Od" |
|
353 |
C_O_FLAG_SIZE="-Os" |
|
354 |
fi |
|
355 |
||
356 |
# Now copy to C++ flags |
|
357 |
CXX_O_FLAG_HIGHEST_JVM="$C_O_FLAG_HIGHEST_JVM" |
|
358 |
CXX_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST" |
|
359 |
CXX_O_FLAG_HI="$C_O_FLAG_HI" |
|
360 |
CXX_O_FLAG_NORM="$C_O_FLAG_NORM" |
|
361 |
CXX_O_FLAG_DEBUG="$C_O_FLAG_DEBUG" |
|
362 |
CXX_O_FLAG_DEBUG_JVM="$C_O_FLAG_DEBUG_JVM" |
|
363 |
CXX_O_FLAG_NONE="$C_O_FLAG_NONE" |
|
364 |
CXX_O_FLAG_SIZE="$C_O_FLAG_SIZE" |
|
365 |
||
366 |
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
|
367 |
# In solstudio, also add this to C (but not C++) flags... |
|
368 |
C_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST -xalias_level=basic" |
|
369 |
fi |
|
370 |
||
371 |
# Adjust optimization flags according to debug level. |
|
372 |
case $DEBUG_LEVEL in |
|
373 |
release ) |
|
374 |
# no adjustment |
|
375 |
;; |
|
376 |
fastdebug ) |
|
377 |
# Not quite so much optimization |
|
378 |
C_O_FLAG_HI="$C_O_FLAG_NORM" |
|
379 |
CXX_O_FLAG_HI="$CXX_O_FLAG_NORM" |
|
380 |
;; |
|
381 |
slowdebug ) |
|
382 |
# Disable optimization |
|
383 |
C_O_FLAG_HIGHEST_JVM="$C_O_FLAG_DEBUG_JVM" |
|
384 |
C_O_FLAG_HIGHEST="$C_O_FLAG_DEBUG" |
|
385 |
C_O_FLAG_HI="$C_O_FLAG_DEBUG" |
|
386 |
C_O_FLAG_NORM="$C_O_FLAG_DEBUG" |
|
387 |
C_O_FLAG_SIZE="$C_O_FLAG_DEBUG" |
|
388 |
CXX_O_FLAG_HIGHEST_JVM="$CXX_O_FLAG_DEBUG_JVM" |
|
389 |
CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_DEBUG" |
|
390 |
CXX_O_FLAG_HI="$CXX_O_FLAG_DEBUG" |
|
391 |
CXX_O_FLAG_NORM="$CXX_O_FLAG_DEBUG" |
|
392 |
CXX_O_FLAG_SIZE="$CXX_O_FLAG_DEBUG" |
|
393 |
;; |
|
394 |
esac |
|
395 |
||
396 |
AC_SUBST(C_O_FLAG_HIGHEST_JVM) |
|
397 |
AC_SUBST(C_O_FLAG_HIGHEST) |
|
398 |
AC_SUBST(C_O_FLAG_HI) |
|
399 |
AC_SUBST(C_O_FLAG_NORM) |
|
400 |
AC_SUBST(C_O_FLAG_NONE) |
|
401 |
AC_SUBST(C_O_FLAG_SIZE) |
|
402 |
AC_SUBST(CXX_O_FLAG_HIGHEST_JVM) |
|
403 |
AC_SUBST(CXX_O_FLAG_HIGHEST) |
|
404 |
AC_SUBST(CXX_O_FLAG_HI) |
|
405 |
AC_SUBST(CXX_O_FLAG_NORM) |
|
406 |
AC_SUBST(CXX_O_FLAG_NONE) |
|
407 |
AC_SUBST(CXX_O_FLAG_SIZE) |
|
408 |
]) |
|
409 |
||
410 |
AC_DEFUN([FLAGS_SETUP_CFLAGS], |
|
411 |
[ |
|
412 |
### CFLAGS |
|
413 |
||
414 |
FLAGS_SETUP_CFLAGS_HELPER |
|
415 |
||
416 |
FLAGS_OS=$OPENJDK_TARGET_OS |
|
417 |
FLAGS_OS_TYPE=$OPENJDK_TARGET_OS_TYPE |
|
418 |
FLAGS_CPU=$OPENJDK_TARGET_CPU |
|
419 |
FLAGS_CPU_ARCH=$OPENJDK_TARGET_CPU_ARCH |
|
420 |
FLAGS_CPU_BITS=$OPENJDK_TARGET_CPU_BITS |
|
421 |
FLAGS_CPU_ENDIAN=$OPENJDK_TARGET_CPU_ENDIAN |
|
422 |
FLAGS_CPU_LEGACY=$OPENJDK_TARGET_CPU_LEGACY |
|
423 |
FLAGS_CPU_LEGACY_LIB=$OPENJDK_TARGET_CPU_LEGACY_LIB |
|
424 |
||
425 |
FLAGS_SETUP_CFLAGS_CPU_DEP([TARGET]) |
|
426 |
||
427 |
FLAGS_OS=$OPENJDK_BUILD_OS |
|
428 |
FLAGS_OS_TYPE=$OPENJDK_BUILD_OS_TYPE |
|
429 |
FLAGS_CPU=$OPENJDK_BUILD_CPU |
|
430 |
FLAGS_CPU_ARCH=$OPENJDK_BUILD_CPU_ARCH |
|
431 |
FLAGS_CPU_BITS=$OPENJDK_BUILD_CPU_BITS |
|
432 |
FLAGS_CPU_ENDIAN=$OPENJDK_BUILD_CPU_ENDIAN |
|
433 |
FLAGS_CPU_LEGACY=$OPENJDK_BUILD_CPU_LEGACY |
|
434 |
FLAGS_CPU_LEGACY_LIB=$OPENJDK_BUILD_CPU_LEGACY_LIB |
|
435 |
||
53643
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
436 |
FLAGS_SETUP_CFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_], [BUILD_]) |
49120 | 437 |
]) |
438 |
||
439 |
################################################################################ |
|
440 |
# platform independent |
|
441 |
AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER], |
|
442 |
[ |
|
443 |
#### OS DEFINES, these should be independent on toolchain |
|
444 |
if test "x$OPENJDK_TARGET_OS" = xlinux; then |
|
445 |
CFLAGS_OS_DEF_JVM="-DLINUX" |
|
446 |
CFLAGS_OS_DEF_JDK="-D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE" |
|
447 |
elif test "x$OPENJDK_TARGET_OS" = xsolaris; then |
|
448 |
CFLAGS_OS_DEF_JVM="-DSOLARIS" |
|
449 |
CFLAGS_OS_DEF_JDK="-D__solaris__" |
|
450 |
elif test "x$OPENJDK_TARGET_OS" = xmacosx; then |
|
451 |
CFLAGS_OS_DEF_JVM="-D_ALLBSD_SOURCE -D_DARWIN_C_SOURCE -D_XOPEN_SOURCE" |
|
452 |
CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT" |
|
453 |
elif test "x$OPENJDK_TARGET_OS" = xaix; then |
|
454 |
CFLAGS_OS_DEF_JVM="-DAIX" |
|
455 |
elif test "x$OPENJDK_TARGET_OS" = xbsd; then |
|
456 |
CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE" |
|
457 |
elif test "x$OPENJDK_TARGET_OS" = xwindows; then |
|
458 |
CFLAGS_OS_DEF_JVM="-D_WINDOWS -DWIN32 -D_JNI_IMPLEMENTATION_" |
|
459 |
fi |
|
460 |
||
461 |
CFLAGS_OS_DEF_JDK="$CFLAGS_OS_DEF_JDK -D$OPENJDK_TARGET_OS_UPPERCASE" |
|
462 |
||
463 |
#### GLOBAL DEFINES |
|
464 |
# Set some common defines. These works for all compilers, but assume |
|
465 |
# -D is universally accepted. |
|
466 |
||
467 |
# Always enable optional macros for VM. |
|
468 |
ALWAYS_CFLAGS_JVM="-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS" |
|
469 |
||
470 |
# Setup some hard coded includes |
|
471 |
ALWAYS_CFLAGS_JDK=" \ |
|
472 |
-I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \ |
|
473 |
-I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base/\$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \ |
|
474 |
-I${TOPDIR}/src/java.base/share/native/libjava \ |
|
475 |
-I${TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/libjava \ |
|
476 |
-I${TOPDIR}/src/hotspot/share/include \ |
|
477 |
-I${TOPDIR}/src/hotspot/os/${HOTSPOT_TARGET_OS_TYPE}/include" |
|
478 |
||
479 |
############################################################################### |
|
480 |
||
481 |
# Adjust flags according to debug level. |
|
482 |
# Setup debug/release defines |
|
483 |
if test "x$DEBUG_LEVEL" = xrelease; then |
|
484 |
DEBUG_CFLAGS_JDK="-DNDEBUG" |
|
485 |
if test "x$OPENJDK_TARGET_OS" = xsolaris; then |
|
486 |
DEBUG_CFLAGS_JDK="$DEBUG_CFLAGS_JDK -DTRIMMED" |
|
487 |
fi |
|
488 |
else |
|
489 |
DEBUG_CFLAGS_JDK="-DDEBUG" |
|
490 |
||
491 |
if test "x$TOOLCHAIN_TYPE" = xxlc; then |
|
492 |
# We need '-qminimaltoc' or '-qpic=large -bbigtoc' if the TOC overflows. |
|
493 |
# Hotspot now overflows its 64K TOC (currently only for debug), |
|
494 |
# so for debug we build with '-qpic=large -bbigtoc'. |
|
495 |
DEBUG_CFLAGS_JVM="-qpic=large" |
|
496 |
fi |
|
497 |
fi |
|
498 |
||
499 |
if test "x$DEBUG_LEVEL" != xrelease; then |
|
500 |
DEBUG_OPTIONS_FLAGS_JDK="$CFLAGS_DEBUG_OPTIONS" |
|
501 |
DEBUG_SYMBOLS_CFLAGS_JDK="$CFLAGS_DEBUG_SYMBOLS" |
|
502 |
fi |
|
503 |
||
504 |
#### TOOLCHAIN DEFINES |
|
505 |
||
506 |
if test "x$TOOLCHAIN_TYPE" = xgcc; then |
|
507 |
ALWAYS_DEFINES_JVM="-D_GNU_SOURCE -D_REENTRANT" |
|
508 |
elif test "x$TOOLCHAIN_TYPE" = xclang; then |
|
509 |
ALWAYS_DEFINES_JVM="-D_GNU_SOURCE" |
|
510 |
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
|
511 |
ALWAYS_DEFINES_JVM="-DSPARC_WORKS -D_Crun_inline_placement" |
|
512 |
ALWAYS_DEFINES_JDK="-DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS" |
|
513 |
ALWAYS_DEFINES_JDK_CXXONLY="-DCC_NOEX" |
|
514 |
elif test "x$TOOLCHAIN_TYPE" = xxlc; then |
|
515 |
ALWAYS_DEFINES_JVM="-D_REENTRANT" |
|
516 |
ALWAYS_DEFINES_JDK="-D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC" |
|
517 |
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then |
|
518 |
ALWAYS_DEFINES_JDK="-DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE \ |
|
519 |
-D_CRT_NONSTDC_NO_DEPRECATE -DWIN32 -DIAL" |
|
49726
4ae63fcabe2e
8199736: Define WIN32_LEAN_AND_MEAN before including windows.h
rwestberg
parents:
49679
diff
changeset
|
520 |
ALWAYS_DEFINES_JVM="-DNOMINMAX -DWIN32_LEAN_AND_MEAN" |
49120 | 521 |
fi |
522 |
||
523 |
############################################################################### |
|
524 |
# |
|
525 |
# |
|
526 |
# CFLAGS BASIC |
|
527 |
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then |
|
528 |
# COMMON to gcc and clang |
|
529 |
TOOLCHAIN_CFLAGS_JVM="-pipe -fno-rtti -fno-exceptions \ |
|
530 |
-fvisibility=hidden -fno-strict-aliasing -fno-omit-frame-pointer" |
|
531 |
fi |
|
532 |
||
533 |
if test "x$TOOLCHAIN_TYPE" = xgcc; then |
|
53332 | 534 |
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -fcheck-new -fstack-protector" |
535 |
TOOLCHAIN_CFLAGS_JDK="-pipe -fstack-protector" |
|
53643
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
536 |
# 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
|
537 |
# no-strict-aliasing everywhere!) |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
538 |
TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" |
49120 | 539 |
|
540 |
elif test "x$TOOLCHAIN_TYPE" = xclang; then |
|
541 |
# Restrict the debug information created by Clang to avoid |
|
542 |
# too big object files and speed the build up a little bit |
|
543 |
# (see http://llvm.org/bugs/show_bug.cgi?id=7554) |
|
544 |
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -flimit-debug-info" |
|
545 |
||
50781 | 546 |
# In principle the stack alignment below is cpu- and ABI-dependent and |
547 |
# should agree with values of StackAlignmentInBytes in various |
|
548 |
# src/hotspot/cpu/*/globalDefinitions_*.hpp files, but this value currently |
|
549 |
# works for all platforms. |
|
550 |
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -mno-omit-leaf-frame-pointer -mstack-alignment=16" |
|
551 |
||
49120 | 552 |
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
|
553 |
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
|
554 |
# 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
|
555 |
# 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
|
556 |
# 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
|
557 |
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
|
558 |
fi |
49120 | 559 |
TOOLCHAIN_CFLAGS_JDK="-pipe" |
560 |
TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX |
|
561 |
fi |
|
562 |
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
|
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
563 |
TOOLCHAIN_FLAGS="-errtags -errfmt" |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
564 |
TOOLCHAIN_CFLAGS="-errshort=tags" |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
565 |
|
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
566 |
TOOLCHAIN_CFLAGS_JDK="-mt $TOOLCHAIN_FLAGS" |
53078 | 567 |
TOOLCHAIN_CFLAGS_JDK_CONLY="-xCC -Xa -W0,-noglobal $TOOLCHAIN_CFLAGS" # C only |
49120 | 568 |
TOOLCHAIN_CFLAGS_JDK_CXXONLY="-features=no%except -norunpath -xnolib" # CXX only |
569 |
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
|
570 |
-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
|
571 |
if test "x$DEBUG_LEVEL" = xslowdebug; then |
7cd937277d5e
8199338: Use -g0 on solstudio also for compiling C programs
ihse
parents:
49120
diff
changeset
|
572 |
# 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
|
573 |
# to setting +d. |
7cd937277d5e
8199338: Use -g0 on solstudio also for compiling C programs
ihse
parents:
49120
diff
changeset
|
574 |
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM +d" |
7cd937277d5e
8199338: Use -g0 on solstudio also for compiling C programs
ihse
parents:
49120
diff
changeset
|
575 |
fi |
7cd937277d5e
8199338: Use -g0 on solstudio also for compiling C programs
ihse
parents:
49120
diff
changeset
|
576 |
|
49120 | 577 |
elif test "x$TOOLCHAIN_TYPE" = xxlc; then |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
578 |
# Suggested additions: -qsrcmsg to get improved error reporting |
53366 | 579 |
TOOLCHAIN_CFLAGS_JDK="-qchars=signed -qfullpath -qsaveopt -qstackprotect" # add on both CFLAGS |
49120 | 580 |
TOOLCHAIN_CFLAGS_JVM="-qtune=balanced \ |
581 |
-qalias=noansi -qstrict -qtls=default -qlanglvl=c99vla \ |
|
53366 | 582 |
-qlanglvl=noredefmac -qnortti -qnoeh -qignerrno -qstackprotect" |
49120 | 583 |
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then |
584 |
TOOLCHAIN_CFLAGS_JVM="-nologo -MD -MP" |
|
585 |
TOOLCHAIN_CFLAGS_JDK="-nologo -MD -Zc:wchar_t-" |
|
586 |
fi |
|
587 |
||
588 |
# CFLAGS WARNINGS STUFF |
|
589 |
# Set JVM_CFLAGS warning handling |
|
590 |
if test "x$TOOLCHAIN_TYPE" = xgcc; then |
|
51853
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
591 |
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
|
592 |
WARNING_CFLAGS_JDK_CXXONLY="$WARNINGS_ENABLE_ALL_CXXFLAGS" |
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
593 |
WARNING_CFLAGS_JVM="$WARNINGS_ENABLE_ALL_CXXFLAGS" |
49120 | 594 |
|
595 |
elif test "x$TOOLCHAIN_TYPE" = xclang; then |
|
51853
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
596 |
WARNING_CFLAGS="$WARNINGS_ENABLE_ALL" |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
597 |
|
49120 | 598 |
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
599 |
WARNING_CFLAGS_JDK_CONLY="$WARNINGS_ENABLE_ALL_CFLAGS" |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
600 |
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
|
601 |
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
|
602 |
|
49120 | 603 |
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then |
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
604 |
WARNING_CFLAGS="$WARNINGS_ENABLE_ALL" |
51853
ec62d6cab037
8211029: Have a common set of enabled warnings for all native libraries
ihse
parents:
51839
diff
changeset
|
605 |
|
51839
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
606 |
elif test "x$TOOLCHAIN_TYPE" = xxlc; then |
ab54a4d61d7f
8210988: Improved handling of compiler warnings in the build
ihse
parents:
51814
diff
changeset
|
607 |
WARNING_CFLAGS="" # currently left empty |
49120 | 608 |
fi |
609 |
||
610 |
# Set some additional per-OS defines. |
|
611 |
||
612 |
# Additional macosx handling |
|
613 |
if test "x$OPENJDK_TARGET_OS" = xmacosx; then |
|
614 |
OS_CFLAGS="-DMAC_OS_X_VERSION_MIN_REQUIRED=$MACOSX_VERSION_MIN_NODOTS \ |
|
615 |
-mmacosx-version-min=$MACOSX_VERSION_MIN" |
|
616 |
||
617 |
if test -n "$MACOSX_VERSION_MAX"; then |
|
618 |
OS_CFLAGS="$OS_CFLAGS \ |
|
619 |
-DMAC_OS_X_VERSION_MAX_ALLOWED=$MACOSX_VERSION_MAX_NODOTS" |
|
620 |
fi |
|
621 |
fi |
|
622 |
||
623 |
# Where does this really belong?? |
|
624 |
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then |
|
625 |
PICFLAG="-fPIC" |
|
626 |
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
|
627 |
PICFLAG="-KPIC" |
|
628 |
elif test "x$TOOLCHAIN_TYPE" = xxlc; then |
|
629 |
# '-qpic' defaults to 'qpic=small'. This means that the compiler generates only |
|
630 |
# one instruction for accessing the TOC. If the TOC grows larger than 64K, the linker |
|
631 |
# 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
|
632 |
# does the load from the TOC. This is of course slower, and we also would have |
49120 | 633 |
# to use '-bbigtoc' for linking anyway so we could also change the PICFLAG to 'qpic=large'. |
634 |
# With 'qpic=large' the compiler will by default generate a two-instruction sequence which |
|
635 |
# 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
|
636 |
# |
41ff671ed8cf
8204935: [aix] TOC overflow in libjvm.so (release build)
stuefe
parents:
49907
diff
changeset
|
637 |
# 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
|
638 |
# 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
|
639 |
# libjvm with -qpic=large and link with -bbigtoc. |
41ff671ed8cf
8204935: [aix] TOC overflow in libjvm.so (release build)
stuefe
parents:
49907
diff
changeset
|
640 |
JVM_PICFLAG="-qpic=large" |
41ff671ed8cf
8204935: [aix] TOC overflow in libjvm.so (release build)
stuefe
parents:
49907
diff
changeset
|
641 |
JDK_PICFLAG="-qpic" |
49120 | 642 |
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then |
643 |
PICFLAG="" |
|
644 |
fi |
|
645 |
||
50550
41ff671ed8cf
8204935: [aix] TOC overflow in libjvm.so (release build)
stuefe
parents:
49907
diff
changeset
|
646 |
if test "x$TOOLCHAIN_TYPE" != xxlc; then |
41ff671ed8cf
8204935: [aix] TOC overflow in libjvm.so (release build)
stuefe
parents:
49907
diff
changeset
|
647 |
JVM_PICFLAG="$PICFLAG" |
41ff671ed8cf
8204935: [aix] TOC overflow in libjvm.so (release build)
stuefe
parents:
49907
diff
changeset
|
648 |
JDK_PICFLAG="$PICFLAG" |
41ff671ed8cf
8204935: [aix] TOC overflow in libjvm.so (release build)
stuefe
parents:
49907
diff
changeset
|
649 |
fi |
49120 | 650 |
|
651 |
if test "x$OPENJDK_TARGET_OS" = xmacosx; then |
|
652 |
# Linking is different on MacOSX |
|
653 |
JDK_PICFLAG='' |
|
654 |
if test "x$STATIC_BUILD" = xtrue; then |
|
655 |
JVM_PICFLAG="" |
|
656 |
fi |
|
657 |
fi |
|
658 |
||
659 |
# Optional POSIX functionality needed by the JVM |
|
660 |
# |
|
661 |
# Check if clock_gettime is available and in which library. This indicates |
|
662 |
# availability of CLOCK_MONOTONIC for hotspot. But we don't need to link, so |
|
663 |
# don't let it update LIBS. |
|
664 |
save_LIBS="$LIBS" |
|
665 |
AC_SEARCH_LIBS(clock_gettime, rt, [HAS_CLOCK_GETTIME=true], []) |
|
666 |
if test "x$LIBS" = "x-lrt "; then |
|
667 |
CLOCK_GETTIME_IN_LIBRT=true |
|
668 |
fi |
|
669 |
LIBS="$save_LIBS" |
|
670 |
||
671 |
if test "x$HAS_CLOCK_GETTIME" = "xtrue"; then |
|
672 |
OS_CFLAGS_JVM="$OS_CFLAGS_JVM -DSUPPORTS_CLOCK_MONOTONIC" |
|
673 |
if test "x$CLOCK_GETTIME_IN_LIBRT" = "xtrue"; then |
|
674 |
OS_CFLAGS_JVM="$OS_CFLAGS_JVM -DNEEDS_LIBRT" |
|
675 |
fi |
|
676 |
fi |
|
677 |
]) |
|
678 |
||
679 |
################################################################################ |
|
680 |
# $1 - Either BUILD or TARGET to pick the correct OS/CPU variables to check |
|
681 |
# conditionals against. |
|
682 |
# $2 - Optional prefix for each variable defined. |
|
53643
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
683 |
# $3 - Optional prefix for compiler variables (either BUILD_ or nothing). |
49120 | 684 |
AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP], |
685 |
[ |
|
686 |
#### CPU DEFINES, these should (in theory) be independent on toolchain |
|
687 |
||
688 |
# Setup target CPU |
|
689 |
# Setup endianness |
|
690 |
if test "x$FLAGS_CPU_ENDIAN" = xlittle; then |
|
691 |
$1_DEFINES_CPU_JVM="-DVM_LITTLE_ENDIAN" |
|
692 |
fi |
|
693 |
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
|
694 |
# The macro _LITTLE_ENDIAN needs to be defined the same to avoid the |
|
695 |
# Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN |
|
696 |
if test "x$FLAGS_CPU_ENDIAN" = xlittle; then |
|
697 |
$1_DEFINES_CPU_JDK="-D_LITTLE_ENDIAN=" |
|
698 |
else |
|
699 |
$1_DEFINES_CPU_JDK="-D_BIG_ENDIAN=" |
|
700 |
fi |
|
701 |
else |
|
702 |
if test "x$FLAGS_CPU_ENDIAN" = xlittle; then |
|
703 |
$1_DEFINES_CPU_JDK="-D_LITTLE_ENDIAN" |
|
704 |
else |
|
705 |
$1_DEFINES_CPU_JDK="-D_BIG_ENDIAN" |
|
706 |
fi |
|
707 |
fi |
|
708 |
||
709 |
# setup CPU bit size |
|
710 |
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -DARCH='\"$FLAGS_CPU_LEGACY\"' \ |
|
711 |
-D$FLAGS_CPU_LEGACY" |
|
712 |
||
713 |
if test "x$FLAGS_CPU_BITS" = x64; then |
|
714 |
# -D_LP64=1 is only set on linux and mac. Setting on windows causes diff in |
|
715 |
# unpack200.exe. |
|
716 |
if test "x$FLAGS_OS" = xlinux || test "x$FLAGS_OS" = xmacosx; then |
|
717 |
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_LP64=1" |
|
718 |
fi |
|
719 |
if test "x$FLAGS_OS" != xsolaris && test "x$FLAGS_OS" != xaix; then |
|
720 |
# Solaris does not have _LP64=1 in the old build. |
|
721 |
# xlc on AIX defines _LP64=1 by default and issues a warning if we redefine it. |
|
722 |
$1_DEFINES_CPU_JVM="${$1_DEFINES_CPU_JVM} -D_LP64=1" |
|
723 |
fi |
|
724 |
fi |
|
725 |
||
726 |
# toolchain dependend, per-cpu |
|
727 |
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
|
728 |
if test "x$FLAGS_CPU_ARCH" = xx86; then |
|
729 |
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -DcpuIntel -Di586 -D$FLAGS_CPU_LEGACY_LIB" |
|
730 |
fi |
|
731 |
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then |
|
732 |
if test "x$FLAGS_CPU" = xx86_64; then |
|
733 |
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_AMD64_ -Damd64" |
|
734 |
else |
|
735 |
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_X86_ -Dx86" |
|
736 |
fi |
|
737 |
fi |
|
738 |
||
739 |
# CFLAGS PER CPU |
|
740 |
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then |
|
741 |
# COMMON to gcc and clang |
|
742 |
if test "x$FLAGS_CPU" = xx86; then |
|
743 |
# Force compatibility with i586 on 32 bit intel platforms. |
|
744 |
$1_CFLAGS_CPU="-march=i586" |
|
745 |
fi |
|
746 |
fi |
|
747 |
||
748 |
if test "x$TOOLCHAIN_TYPE" = xgcc; then |
|
749 |
if test "x$FLAGS_CPU" = xarm; then |
|
750 |
# -Wno-psabi to get rid of annoying "note: the mangling of 'va_list' has changed in GCC 4.4" |
|
751 |
$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)\"'" |
|
752 |
$1_CFLAGS_CPU_JVM="-DARM" |
|
753 |
elif test "x$FLAGS_CPU_ARCH" = xppc; then |
|
754 |
$1_CFLAGS_CPU_JVM="-minsert-sched-nops=regroup_exact -mno-multiple -mno-string" |
|
755 |
if test "x$FLAGS_CPU" = xppc64; then |
|
756 |
# -mminimal-toc fixes `relocation truncated to fit' error for gcc 4.1. |
|
757 |
# Use ppc64 instructions, but schedule for power5 |
|
758 |
$1_CFLAGS_CPU_JVM="${$1_CFLAGS_CPU_JVM} -mminimal-toc -mcpu=powerpc64 -mtune=power5" |
|
759 |
elif test "x$FLAGS_CPU" = xppc64le; then |
|
760 |
# Little endian machine uses ELFv2 ABI. |
|
761 |
# Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI. |
|
762 |
$1_CFLAGS_CPU_JVM="${$1_CFLAGS_CPU_JVM} -DABI_ELFv2 -mcpu=power8 -mtune=power8" |
|
763 |
fi |
|
764 |
elif test "x$FLAGS_CPU" = xs390x; then |
|
765 |
$1_CFLAGS_CPU="-mbackchain -march=z10" |
|
766 |
fi |
|
767 |
||
768 |
if test "x$FLAGS_CPU_ARCH" != xarm && test "x$FLAGS_CPU_ARCH" != xppc; then |
|
769 |
# for all archs except arm and ppc, prevent gcc to omit frame pointer |
|
770 |
$1_CFLAGS_CPU_JDK="${$1_CFLAGS_CPU_JDK} -fno-omit-frame-pointer" |
|
771 |
fi |
|
772 |
||
53643
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
773 |
$1_CXXSTD_CXXFLAG="-std=gnu++98" |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
774 |
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
|
775 |
PREFIX: $3, IF_FALSE: [$1_CXXSTD_CXXFLAG=""]) |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
776 |
$1_TOOLCHAIN_CFLAGS_JDK_CXXONLY="${$1_CXXSTD_CXXFLAG}" |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
777 |
$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
|
778 |
$2ADLC_CXXFLAG="${$1_CXXSTD_CXXFLAG}" |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
779 |
|
49120 | 780 |
elif test "x$TOOLCHAIN_TYPE" = xclang; then |
781 |
if test "x$FLAGS_OS" = xlinux; then |
|
782 |
# ppc test not really needed for clang |
|
783 |
if test "x$FLAGS_CPU_ARCH" != xarm && test "x$FLAGS_CPU_ARCH" != xppc; then |
|
784 |
# for all archs except arm and ppc, prevent gcc to omit frame pointer |
|
785 |
$1_CFLAGS_CPU_JDK="${$1_CFLAGS_CPU_JDK} -fno-omit-frame-pointer" |
|
786 |
fi |
|
787 |
fi |
|
788 |
||
789 |
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then |
|
790 |
if test "x$FLAGS_CPU" = xx86_64; then |
|
791 |
# NOTE: -xregs=no%frameptr is supposed to be default on x64 |
|
792 |
$1_CFLAGS_CPU_JDK="-xregs=no%frameptr" |
|
793 |
elif test "x$FLAGS_CPU" = xsparcv9; then |
|
794 |
$1_CFLAGS_CPU_JVM="-xarch=sparc" |
|
795 |
$1_CFLAGS_CPU_JDK_LIBONLY="-xregs=no%appl" |
|
796 |
fi |
|
797 |
||
798 |
elif test "x$TOOLCHAIN_TYPE" = xxlc; then |
|
799 |
if test "x$FLAGS_CPU" = xppc64; then |
|
800 |
$1_CFLAGS_CPU_JVM="-qarch=ppc64" |
|
801 |
fi |
|
802 |
||
803 |
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then |
|
804 |
if test "x$FLAGS_CPU" = xx86; then |
|
805 |
$1_CFLAGS_CPU_JVM="-arch:IA32" |
|
806 |
elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then |
|
807 |
if test "x$DEBUG_LEVEL" != xrelease; then |
|
808 |
# NOTE: This is probably redundant; -homeparams is default on |
|
809 |
# non-release builds. |
|
810 |
$1_CFLAGS_CPU_JVM="-homeparams" |
|
811 |
fi |
|
812 |
fi |
|
813 |
fi |
|
814 |
||
815 |
if test "x$TOOLCHAIN_TYPE" = xgcc; then |
|
53643
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
816 |
FLAGS_SETUP_GCC6_COMPILER_FLAGS($1, $3) |
49120 | 817 |
$1_TOOLCHAIN_CFLAGS="${$1_GCC6_CFLAGS}" |
818 |
||
49200 | 819 |
$1_WARNING_CFLAGS_JVM="-Wno-format-zero-length -Wtype-limits -Wuninitialized" |
49120 | 820 |
fi |
821 |
||
54490
bf07e140c49c
8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
erikj
parents:
53837
diff
changeset
|
822 |
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
|
823 |
# 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
|
824 |
# 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
|
825 |
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
|
826 |
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
|
827 |
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
|
828 |
PREFIX: $3, |
bf07e140c49c
8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
erikj
parents:
53837
diff
changeset
|
829 |
IF_FALSE: [ |
bf07e140c49c
8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
erikj
parents:
53837
diff
changeset
|
830 |
FILE_MACRO_CFLAGS= |
bf07e140c49c
8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
erikj
parents:
53837
diff
changeset
|
831 |
] |
bf07e140c49c
8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
erikj
parents:
53837
diff
changeset
|
832 |
) |
bf07e140c49c
8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
erikj
parents:
53837
diff
changeset
|
833 |
fi |
bf07e140c49c
8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
erikj
parents:
53837
diff
changeset
|
834 |
|
49120 | 835 |
# EXPORT to API |
53643
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
836 |
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
|
837 |
$TOOLCHAIN_CFLAGS_JVM ${$1_TOOLCHAIN_CFLAGS_JVM} \ |
49120 | 838 |
$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
|
839 |
$WARNING_CFLAGS $WARNING_CFLAGS_JVM $JVM_PICFLAG $FILE_MACRO_CFLAGS" |
49120 | 840 |
|
841 |
CFLAGS_JDK_COMMON="$ALWAYS_CFLAGS_JDK $ALWAYS_DEFINES_JDK $TOOLCHAIN_CFLAGS_JDK \ |
|
842 |
$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
|
843 |
$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
|
844 |
$FILE_MACRO_CFLAGS" |
49120 | 845 |
|
846 |
# Use ${$2EXTRA_CFLAGS} to block EXTRA_CFLAGS to be added to build flags. |
|
847 |
# (Currently we don't have any OPENJDK_BUILD_EXTRA_CFLAGS, but that might |
|
848 |
# change in the future.) |
|
849 |
||
49155
7cd937277d5e
8199338: Use -g0 on solstudio also for compiling C programs
ihse
parents:
49120
diff
changeset
|
850 |
CFLAGS_JDK_COMMON_CONLY="$TOOLCHAIN_CFLAGS_JDK_CONLY \ |
49120 | 851 |
$WARNING_CFLAGS_JDK_CONLY ${$2EXTRA_CFLAGS}" |
53643
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
852 |
CFLAGS_JDK_COMMON_CXXONLY="$ALWAYS_DEFINES_JDK_CXXONLY \ |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
853 |
$TOOLCHAIN_CFLAGS_JDK_CXXONLY \ |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
854 |
${$1_TOOLCHAIN_CFLAGS_JDK_CXXONLY} \ |
49155
7cd937277d5e
8199338: Use -g0 on solstudio also for compiling C programs
ihse
parents:
49120
diff
changeset
|
855 |
$WARNING_CFLAGS_JDK_CXXONLY ${$2EXTRA_CXXFLAGS}" |
49120 | 856 |
|
857 |
$1_CFLAGS_JVM="${$1_DEFINES_CPU_JVM} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JVM} ${$1_TOOLCHAIN_CFLAGS} ${$1_WARNING_CFLAGS_JVM}" |
|
858 |
$1_CFLAGS_JDK="${$1_DEFINES_CPU_JDK} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JDK} ${$1_TOOLCHAIN_CFLAGS}" |
|
859 |
||
860 |
$2JVM_CFLAGS="$CFLAGS_JVM_COMMON ${$1_CFLAGS_JVM} ${$2EXTRA_CXXFLAGS}" |
|
861 |
||
862 |
$2CFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CONLY ${$1_CFLAGS_JDK}" |
|
863 |
$2CXXFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CXXONLY ${$1_CFLAGS_JDK}" |
|
864 |
$2CFLAGS_JDKLIB="${$2CFLAGS_JDKEXE} $JDK_PICFLAG ${$1_CFLAGS_CPU_JDK_LIBONLY}" |
|
865 |
$2CXXFLAGS_JDKLIB="${$2CXXFLAGS_JDKEXE} $JDK_PICFLAG ${$1_CFLAGS_CPU_JDK_LIBONLY}" |
|
866 |
||
867 |
AC_SUBST($2JVM_CFLAGS) |
|
868 |
AC_SUBST($2CFLAGS_JDKLIB) |
|
869 |
AC_SUBST($2CFLAGS_JDKEXE) |
|
870 |
AC_SUBST($2CXXFLAGS_JDKLIB) |
|
871 |
AC_SUBST($2CXXFLAGS_JDKEXE) |
|
53643
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
872 |
AC_SUBST($2ADLC_CXXFLAG) |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
873 |
|
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
874 |
COMPILER_FP_CONTRACT_OFF_FLAG="-ffp-contract=off" |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
875 |
# 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
|
876 |
# 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
|
877 |
# otherwise. |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
878 |
# 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
|
879 |
# fdlibm with optimization without losing precision. |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
880 |
# 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
|
881 |
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
|
882 |
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
|
883 |
PREFIX: $3, |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
884 |
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
|
885 |
IF_FALSE: [$2FDLIBM_CFLAGS=""]) |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
886 |
fi |
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
887 |
AC_SUBST($2FDLIBM_CFLAGS) |
49120 | 888 |
]) |
889 |
||
890 |
# FLAGS_SETUP_GCC6_COMPILER_FLAGS([PREFIX]) |
|
891 |
# Arguments: |
|
892 |
# $1 - Prefix for each variable defined. |
|
53643
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
893 |
# $2 - Prefix for compiler variables (either BUILD_ or nothing). |
49120 | 894 |
AC_DEFUN([FLAGS_SETUP_GCC6_COMPILER_FLAGS], |
895 |
[ |
|
896 |
# These flags are required for GCC 6 builds as undefined behaviour in OpenJDK code |
|
897 |
# runs afoul of the more aggressive versions of these optimisations. |
|
898 |
# Notably, value range propagation now assumes that the this pointer of C++ |
|
899 |
# member functions is non-null. |
|
900 |
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
|
901 |
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
|
902 |
PREFIX: $2, IF_FALSE: [NO_DELETE_NULL_POINTER_CHECKS_CFLAG=""]) |
49120 | 903 |
NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse" |
53643
1126811a5124
8160926: FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation
erikj
parents:
53366
diff
changeset
|
904 |
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
|
905 |
PREFIX: $2, IF_FALSE: [NO_LIFETIME_DSE_CFLAG=""]) |
49120 | 906 |
$1_GCC6_CFLAGS="${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}" |
907 |
]) |
|
908 |
||
909 |
# Documentation on common flags used for solstudio in HIGHEST. |
|
910 |
# |
|
911 |
# WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be |
|
912 |
# done with care, there are some assumptions below that need to |
|
913 |
# be understood about the use of pointers, and IEEE behavior. |
|
914 |
# |
|
915 |
# -fns: Use non-standard floating point mode (not IEEE 754) |
|
916 |
# -fsimple: Do some simplification of floating point arithmetic (not IEEE 754) |
|
917 |
# -fsingle: Use single precision floating point with 'float' |
|
918 |
# -xalias_level=basic: Assume memory references via basic pointer types do not alias |
|
919 |
# (Source with excessing pointer casting and data access with mixed |
|
920 |
# pointer types are not recommended) |
|
921 |
# -xbuiltin=%all: Use intrinsic or inline versions for math/std functions |
|
922 |
# (If you expect perfect errno behavior, do not use this) |
|
923 |
# -xdepend: Loop data dependency optimizations (need -xO3 or higher) |
|
924 |
# -xrestrict: Pointer parameters to functions do not overlap |
|
925 |
# (Similar to -xalias_level=basic usage, but less obvious sometimes. |
|
926 |
# If you pass in multiple pointers to the same data, do not use this) |
|
927 |
# -xlibmil: Inline some library routines |
|
928 |
# (If you expect perfect errno behavior, do not use this) |
|
929 |
# -xlibmopt: Use optimized math routines (CURRENTLY DISABLED) |
|
930 |
# (If you expect perfect errno behavior, do not use this) |
|
931 |
# Can cause undefined external on Solaris 8 X86 on __sincos, removing for now |