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