make/bsd/makefiles/gcc.make

Wed, 27 Apr 2016 01:25:04 +0800

author
aoqi
date
Wed, 27 Apr 2016 01:25:04 +0800
changeset 0
f90c822e73f8
child 6876
710a3c8b516e
permissions
-rw-r--r--

Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/
changeset: 6782:28b50d07f6f8
tag: jdk8u25-b17

aoqi@0 1 #
aoqi@0 2 # Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 #
aoqi@0 5 # This code is free software; you can redistribute it and/or modify it
aoqi@0 6 # under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 # published by the Free Software Foundation.
aoqi@0 8 #
aoqi@0 9 # This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 # version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 # accompanied this code).
aoqi@0 14 #
aoqi@0 15 # You should have received a copy of the GNU General Public License version
aoqi@0 16 # 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 #
aoqi@0 19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 # or visit www.oracle.com if you need additional information or have any
aoqi@0 21 # questions.
aoqi@0 22 #
aoqi@0 23 #
aoqi@0 24
aoqi@0 25 OS_VENDOR = $(shell uname -s)
aoqi@0 26
aoqi@0 27 #------------------------------------------------------------------------
aoqi@0 28 # CC, CXX & AS
aoqi@0 29
aoqi@0 30 # If a SPEC is not set already, then use these defaults.
aoqi@0 31 ifeq ($(SPEC),)
aoqi@0 32 # When cross-compiling the ALT_COMPILER_PATH points
aoqi@0 33 # to the cross-compilation toolset
aoqi@0 34 ifdef CROSS_COMPILE_ARCH
aoqi@0 35 CXX = $(ALT_COMPILER_PATH)/g++
aoqi@0 36 CC = $(ALT_COMPILER_PATH)/gcc
aoqi@0 37 HOSTCXX = g++
aoqi@0 38 HOSTCC = gcc
aoqi@0 39 else ifneq ($(OS_VENDOR), Darwin)
aoqi@0 40 CXX = g++
aoqi@0 41 CC = gcc
aoqi@0 42 HOSTCXX = $(CXX)
aoqi@0 43 HOSTCC = $(CC)
aoqi@0 44 endif
aoqi@0 45
aoqi@0 46 # i486 hotspot requires -mstackrealign on Darwin.
aoqi@0 47 # llvm-gcc supports this in Xcode 3.2.6 and 4.0.
aoqi@0 48 # gcc-4.0 supports this on earlier versions.
aoqi@0 49 # Prefer llvm-gcc where available.
aoqi@0 50 ifeq ($(OS_VENDOR), Darwin)
aoqi@0 51 ifeq ($(origin CXX), default)
aoqi@0 52 CXX = llvm-g++
aoqi@0 53 endif
aoqi@0 54 ifeq ($(origin CC), default)
aoqi@0 55 CC = llvm-gcc
aoqi@0 56 endif
aoqi@0 57
aoqi@0 58 ifeq ($(ARCH), i486)
aoqi@0 59 LLVM_SUPPORTS_STACKREALIGN := $(shell \
aoqi@0 60 [ "0"`llvm-gcc -v 2>&1 | grep LLVM | sed -E "s/.*LLVM build ([0-9]+).*/\1/"` -gt "2333" ] \
aoqi@0 61 && echo true || echo false)
aoqi@0 62
aoqi@0 63 ifeq ($(LLVM_SUPPORTS_STACKREALIGN), true)
aoqi@0 64 CXX32 ?= llvm-g++
aoqi@0 65 CC32 ?= llvm-gcc
aoqi@0 66 else
aoqi@0 67 CXX32 ?= g++-4.0
aoqi@0 68 CC32 ?= gcc-4.0
aoqi@0 69 endif
aoqi@0 70 CXX = $(CXX32)
aoqi@0 71 CC = $(CC32)
aoqi@0 72 endif
aoqi@0 73
aoqi@0 74 ifeq ($(USE_CLANG), true)
aoqi@0 75 CXX = clang++
aoqi@0 76 CC = clang
aoqi@0 77 endif
aoqi@0 78
aoqi@0 79 HOSTCXX = $(CXX)
aoqi@0 80 HOSTCC = $(CC)
aoqi@0 81 endif
aoqi@0 82
aoqi@0 83 AS = $(CC) -c
aoqi@0 84 endif
aoqi@0 85
aoqi@0 86 ifeq ($(OS_VENDOR), Darwin)
aoqi@0 87 ifeq ($(DSYMUTIL),)
aoqi@0 88 DSYMUTIL=dsymutil
aoqi@0 89 endif
aoqi@0 90 endif
aoqi@0 91
aoqi@0 92 ifeq ($(USE_CLANG), true)
aoqi@0 93 CC_VER_MAJOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f1)
aoqi@0 94 CC_VER_MINOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f2)
aoqi@0 95 else
aoqi@0 96 # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
aoqi@0 97 # prints the numbers (e.g. "2.95", "3.2.1")
aoqi@0 98 CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
aoqi@0 99 CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
aoqi@0 100 endif
aoqi@0 101
aoqi@0 102 ifeq ($(USE_CLANG), true)
aoqi@0 103 # clang has precompiled headers support by default, but the user can switch
aoqi@0 104 # it off by using 'USE_PRECOMPILED_HEADER=0'.
aoqi@0 105 ifdef LP64
aoqi@0 106 ifeq ($(USE_PRECOMPILED_HEADER),)
aoqi@0 107 USE_PRECOMPILED_HEADER=1
aoqi@0 108 endif
aoqi@0 109 else
aoqi@0 110 # We don't support precompiled headers on 32-bit builds because there some files are
aoqi@0 111 # compiled with -fPIC while others are compiled without (see 'NONPIC_OBJ_FILES' rules.make)
aoqi@0 112 # Clang produces an error if the PCH file was compiled with other options than the actual compilation unit.
aoqi@0 113 USE_PRECOMPILED_HEADER=0
aoqi@0 114 endif
aoqi@0 115
aoqi@0 116 ifeq ($(USE_PRECOMPILED_HEADER),1)
aoqi@0 117
aoqi@0 118 ifndef LP64
aoqi@0 119 $(error " Precompiled Headers only supported on 64-bit platforms!")
aoqi@0 120 endif
aoqi@0 121
aoqi@0 122 PRECOMPILED_HEADER_DIR=.
aoqi@0 123 PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
aoqi@0 124 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.pch
aoqi@0 125
aoqi@0 126 PCH_FLAG = -include precompiled.hpp
aoqi@0 127 PCH_FLAG/DEFAULT = $(PCH_FLAG)
aoqi@0 128 PCH_FLAG/NO_PCH = -DNO_PCH
aoqi@0 129 PCH_FLAG/BY_FILE = $(PCH_FLAG/$@)$(PCH_FLAG/DEFAULT$(PCH_FLAG/$@))
aoqi@0 130
aoqi@0 131 VM_PCH_FLAG/LIBJVM = $(PCH_FLAG/BY_FILE)
aoqi@0 132 VM_PCH_FLAG/AOUT =
aoqi@0 133 VM_PCH_FLAG = $(VM_PCH_FLAG/$(LINK_INTO))
aoqi@0 134
aoqi@0 135 # We only use precompiled headers for the JVM build
aoqi@0 136 CFLAGS += $(VM_PCH_FLAG)
aoqi@0 137
aoqi@0 138 # The following files are compiled at various optimization
aoqi@0 139 # levels due to optimization issues encountered at the
aoqi@0 140 # 'OPT_CFLAGS_DEFAULT' level. The Clang compiler issues a compile
aoqi@0 141 # time error if there is an optimization level specification
aoqi@0 142 # skew between the PCH file and the C++ file. Especially if the
aoqi@0 143 # PCH file is compiled at a higher optimization level than
aoqi@0 144 # the C++ file. One solution might be to prepare extra optimization
aoqi@0 145 # level specific PCH files for the opt build and use them here, but
aoqi@0 146 # it's probably not worth the effort as long as only a few files
aoqi@0 147 # need this special handling.
aoqi@0 148 PCH_FLAG/loopTransform.o = $(PCH_FLAG/NO_PCH)
aoqi@0 149 PCH_FLAG/sharedRuntimeTrig.o = $(PCH_FLAG/NO_PCH)
aoqi@0 150 PCH_FLAG/sharedRuntimeTrans.o = $(PCH_FLAG/NO_PCH)
aoqi@0 151 PCH_FLAG/unsafe.o = $(PCH_FLAG/NO_PCH)
aoqi@0 152
aoqi@0 153 endif
aoqi@0 154 else # ($(USE_CLANG), true)
aoqi@0 155 # check for precompiled headers support
aoqi@0 156 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
aoqi@0 157 # Allow the user to turn off precompiled headers from the command line.
aoqi@0 158 ifneq ($(USE_PRECOMPILED_HEADER),0)
aoqi@0 159 PRECOMPILED_HEADER_DIR=.
aoqi@0 160 PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
aoqi@0 161 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
aoqi@0 162 endif
aoqi@0 163 endif
aoqi@0 164 endif
aoqi@0 165
aoqi@0 166 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
aoqi@0 167 ifeq ($(USE_PRECOMPILED_HEADER),0)
aoqi@0 168 CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
aoqi@0 169 endif
aoqi@0 170
aoqi@0 171 #------------------------------------------------------------------------
aoqi@0 172 # Compiler flags
aoqi@0 173
aoqi@0 174 # position-independent code
aoqi@0 175 PICFLAG = -fPIC
aoqi@0 176
aoqi@0 177 VM_PICFLAG/LIBJVM = $(PICFLAG)
aoqi@0 178 VM_PICFLAG/AOUT =
aoqi@0 179 VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO))
aoqi@0 180
aoqi@0 181 ifeq ($(JVM_VARIANT_ZERO), true)
aoqi@0 182 CFLAGS += $(LIBFFI_CFLAGS)
aoqi@0 183 endif
aoqi@0 184 ifeq ($(JVM_VARIANT_ZEROSHARK), true)
aoqi@0 185 CFLAGS += $(LIBFFI_CFLAGS)
aoqi@0 186 CFLAGS += $(LLVM_CFLAGS)
aoqi@0 187 endif
aoqi@0 188 CFLAGS += $(VM_PICFLAG)
aoqi@0 189 CFLAGS += -fno-rtti
aoqi@0 190 CFLAGS += -fno-exceptions
aoqi@0 191 ifeq ($(USE_CLANG),)
aoqi@0 192 CFLAGS += -pthread
aoqi@0 193 CFLAGS += -fcheck-new
aoqi@0 194 # version 4 and above support fvisibility=hidden (matches jni_x86.h file)
aoqi@0 195 # except 4.1.2 gives pointless warnings that can't be disabled (afaik)
aoqi@0 196 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
aoqi@0 197 CFLAGS += -fvisibility=hidden
aoqi@0 198 endif
aoqi@0 199 else
aoqi@0 200 CFLAGS += -fvisibility=hidden
aoqi@0 201 endif
aoqi@0 202
aoqi@0 203 ifeq ($(USE_CLANG), true)
aoqi@0 204 # Before Clang 3.1, we had to pass the stack alignment specification directly to llvm with the help of '-mllvm'
aoqi@0 205 # Starting with version 3.1, Clang understands the '-mstack-alignment' (and rejects '-mllvm -stack-alignment')
aoqi@0 206 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 1 \) \))" "0"
aoqi@0 207 STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mstack-alignment=16
aoqi@0 208 else
aoqi@0 209 STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mllvm -stack-alignment=16
aoqi@0 210 endif
aoqi@0 211 endif
aoqi@0 212
aoqi@0 213 ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
aoqi@0 214 ARCHFLAG/i486 = -m32 -march=i586
aoqi@0 215 ARCHFLAG/amd64 = -m64 $(STACK_ALIGNMENT_OPT)
aoqi@0 216 ARCHFLAG/ia64 =
aoqi@0 217 ARCHFLAG/sparc = -m32 -mcpu=v9
aoqi@0 218 ARCHFLAG/sparcv9 = -m64 -mcpu=v9
aoqi@0 219 ARCHFLAG/zero = $(ZERO_ARCHFLAG)
aoqi@0 220
aoqi@0 221 # Darwin-specific build flags
aoqi@0 222 ifeq ($(OS_VENDOR), Darwin)
aoqi@0 223 # Ineffecient 16-byte stack re-alignment on Darwin/IA32
aoqi@0 224 ARCHFLAG/i486 += -mstackrealign
aoqi@0 225 endif
aoqi@0 226
aoqi@0 227 CFLAGS += $(ARCHFLAG)
aoqi@0 228 AOUT_FLAGS += $(ARCHFLAG)
aoqi@0 229 LFLAGS += $(ARCHFLAG)
aoqi@0 230 ASFLAGS += $(ARCHFLAG)
aoqi@0 231
aoqi@0 232 ifdef E500V2
aoqi@0 233 CFLAGS += -DE500V2
aoqi@0 234 endif
aoqi@0 235
aoqi@0 236 # Use C++ Interpreter
aoqi@0 237 ifdef CC_INTERP
aoqi@0 238 CFLAGS += -DCC_INTERP
aoqi@0 239 endif
aoqi@0 240
aoqi@0 241 # Keep temporary files (.ii, .s)
aoqi@0 242 ifdef NEED_ASM
aoqi@0 243 CFLAGS += -save-temps
aoqi@0 244 else
aoqi@0 245 CFLAGS += -pipe
aoqi@0 246 endif
aoqi@0 247
aoqi@0 248 # Compiler warnings are treated as errors
aoqi@0 249 ifneq ($(COMPILER_WARNINGS_FATAL),false)
aoqi@0 250 WARNINGS_ARE_ERRORS = -Werror
aoqi@0 251 endif
aoqi@0 252
aoqi@0 253 ifeq ($(USE_CLANG), true)
aoqi@0 254 # However we need to clean the code up before we can unrestrictedly enable this option with Clang
aoqi@0 255 WARNINGS_ARE_ERRORS += -Wno-logical-op-parentheses -Wno-parentheses-equality -Wno-parentheses
aoqi@0 256 WARNINGS_ARE_ERRORS += -Wno-switch -Wno-tautological-compare
aoqi@0 257 # Not yet supported by clang in Xcode 4.6.2
aoqi@0 258 # WARNINGS_ARE_ERRORS += -Wno-tautological-constant-out-of-range-compare
aoqi@0 259 WARNINGS_ARE_ERRORS += -Wno-delete-non-virtual-dtor -Wno-deprecated -Wno-format -Wno-dynamic-class-memaccess
aoqi@0 260 WARNINGS_ARE_ERRORS += -Wno-empty-body
aoqi@0 261 endif
aoqi@0 262
aoqi@0 263 WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef
aoqi@0 264
aoqi@0 265 ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
aoqi@0 266 # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
aoqi@0 267 # conversions which might affect the values. Only enable it in earlier versions.
aoqi@0 268 WARNING_FLAGS = -Wunused-function
aoqi@0 269 ifeq ($(USE_CLANG),)
aoqi@0 270 WARNING_FLAGS += -Wconversion
aoqi@0 271 endif
aoqi@0 272 endif
aoqi@0 273
aoqi@0 274 CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(WARNING_FLAGS)
aoqi@0 275 # Special cases
aoqi@0 276 CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@))
aoqi@0 277 # XXXDARWIN: for _dyld_bind_fully_image_containing_address
aoqi@0 278 ifeq ($(OS_VENDOR), Darwin)
aoqi@0 279 CFLAGS_WARN/os_bsd.o = $(CFLAGS_WARN/DEFAULT) -Wno-deprecated-declarations
aoqi@0 280 endif
aoqi@0 281
aoqi@0 282 OPT_CFLAGS/SIZE=-Os
aoqi@0 283 OPT_CFLAGS/SPEED=-O3
aoqi@0 284
aoqi@0 285 # Hotspot uses very unstrict aliasing turn this optimization off
aoqi@0 286 # This option is added to CFLAGS rather than OPT_CFLAGS
aoqi@0 287 # so that OPT_CFLAGS overrides get this option too.
aoqi@0 288 CFLAGS += -fno-strict-aliasing
aoqi@0 289
aoqi@0 290 # The flags to use for an Optimized g++ build
aoqi@0 291 ifeq ($(OS_VENDOR), Darwin)
aoqi@0 292 # use -Os by default, unless -O3 can be proved to be worth the cost, as per policy
aoqi@0 293 # <http://wikis.sun.com/display/OpenJDK/Mac+OS+X+Port+Compilers>
aoqi@0 294 OPT_CFLAGS_DEFAULT ?= SIZE
aoqi@0 295 else
aoqi@0 296 OPT_CFLAGS_DEFAULT ?= SPEED
aoqi@0 297 endif
aoqi@0 298
aoqi@0 299 ifdef OPT_CFLAGS
aoqi@0 300 ifneq ("$(origin OPT_CFLAGS)", "command line")
aoqi@0 301 $(error " Use OPT_EXTRAS instead of OPT_CFLAGS to add extra flags to OPT_CFLAGS.")
aoqi@0 302 endif
aoqi@0 303 endif
aoqi@0 304
aoqi@0 305 OPT_CFLAGS = $(OPT_CFLAGS/$(OPT_CFLAGS_DEFAULT)) $(OPT_EXTRAS)
aoqi@0 306
aoqi@0 307 # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp
aoqi@0 308 # if we use expensive-optimizations
aoqi@0 309 ifeq ($(BUILDARCH), ia64)
aoqi@0 310 OPT_CFLAGS += -fno-expensive-optimizations
aoqi@0 311 endif
aoqi@0 312
aoqi@0 313 OPT_CFLAGS/NOOPT=-O0
aoqi@0 314
aoqi@0 315 # Work around some compiler bugs.
aoqi@0 316 ifeq ($(USE_CLANG), true)
aoqi@0 317 ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1)
aoqi@0 318 OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT)
aoqi@0 319 OPT_CFLAGS/unsafe.o += -O1
aoqi@0 320 endif
aoqi@0 321 else
aoqi@0 322 # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation.
aoqi@0 323 ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1)
aoqi@0 324 OPT_CFLAGS/mulnode.o += $(OPT_CFLAGS/NOOPT)
aoqi@0 325 endif
aoqi@0 326 endif
aoqi@0 327
aoqi@0 328 # Flags for generating make dependency flags.
aoqi@0 329 DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
aoqi@0 330 ifeq ($(USE_CLANG),)
aoqi@0 331 ifneq ($(CC_VER_MAJOR), 2)
aoqi@0 332 DEPFLAGS += -fpch-deps
aoqi@0 333 endif
aoqi@0 334 endif
aoqi@0 335
aoqi@0 336 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
aoqi@0 337 ifeq ($(USE_PRECOMPILED_HEADER),0)
aoqi@0 338 CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
aoqi@0 339 endif
aoqi@0 340
aoqi@0 341 ifeq ($(OS_VENDOR), Darwin)
aoqi@0 342 # Setting these parameters makes it an error to link to macosx APIs that are
aoqi@0 343 # newer than the given OS version and makes the linked binaries compatible even
aoqi@0 344 # if built on a newer version of the OS.
aoqi@0 345 # The expected format is X.Y.Z
aoqi@0 346 ifeq ($(MACOSX_VERSION_MIN),)
aoqi@0 347 MACOSX_VERSION_MIN=10.7.0
aoqi@0 348 endif
aoqi@0 349 # The macro takes the version with no dots, ex: 1070
aoqi@0 350 CFLAGS += -DMAC_OS_X_VERSION_MAX_ALLOWED=$(subst .,,$(MACOSX_VERSION_MIN)) \
aoqi@0 351 -mmacosx-version-min=$(MACOSX_VERSION_MIN)
aoqi@0 352 LDFLAGS += -mmacosx-version-min=$(MACOSX_VERSION_MIN)
aoqi@0 353 endif
aoqi@0 354
aoqi@0 355
aoqi@0 356 #------------------------------------------------------------------------
aoqi@0 357 # Assembler flags
aoqi@0 358
aoqi@0 359 # Enforce prerpocessing of .s files
aoqi@0 360 ASFLAGS += -x assembler-with-cpp
aoqi@0 361
aoqi@0 362 #------------------------------------------------------------------------
aoqi@0 363 # Linker flags
aoqi@0 364
aoqi@0 365 # statically link libstdc++.so, work with gcc but ignored by g++
aoqi@0 366 STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
aoqi@0 367
aoqi@0 368 ifeq ($(USE_CLANG),)
aoqi@0 369 # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
aoqi@0 370 ifneq ("${CC_VER_MAJOR}", "2")
aoqi@0 371 STATIC_LIBGCC += -static-libgcc
aoqi@0 372 endif
aoqi@0 373
aoqi@0 374 ifeq ($(BUILDARCH), ia64)
aoqi@0 375 LFLAGS += -Wl,-relax
aoqi@0 376 endif
aoqi@0 377 endif
aoqi@0 378
aoqi@0 379 # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
aoqi@0 380 MAPFLAG = -Xlinker --version-script=FILENAME
aoqi@0 381
aoqi@0 382 #
aoqi@0 383 # Shared Library
aoqi@0 384 #
aoqi@0 385 ifeq ($(OS_VENDOR), Darwin)
aoqi@0 386 # Standard linker flags
aoqi@0 387 LFLAGS +=
aoqi@0 388
aoqi@0 389 # The apple linker has its own variant of mapfiles/version-scripts
aoqi@0 390 MAPFLAG = -Xlinker -exported_symbols_list -Xlinker FILENAME
aoqi@0 391
aoqi@0 392 # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
aoqi@0 393 SONAMEFLAG =
aoqi@0 394
aoqi@0 395 # Build shared library
aoqi@0 396 SHARED_FLAG = -Wl,-install_name,@rpath/$(@F) -dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $(VM_PICFLAG)
aoqi@0 397
aoqi@0 398 # Keep symbols even they are not used
aoqi@0 399 #AOUT_FLAGS += -Xlinker -export-dynamic
aoqi@0 400 else
aoqi@0 401 # Enable linker optimization
aoqi@0 402 LFLAGS += -Xlinker -O1
aoqi@0 403
aoqi@0 404 # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
aoqi@0 405 SONAMEFLAG = -Xlinker -soname=SONAME
aoqi@0 406
aoqi@0 407 # Build shared library
aoqi@0 408 SHARED_FLAG = -shared $(VM_PICFLAG)
aoqi@0 409
aoqi@0 410 # Keep symbols even they are not used
aoqi@0 411 AOUT_FLAGS += -Xlinker -export-dynamic
aoqi@0 412 endif
aoqi@0 413
aoqi@0 414 #------------------------------------------------------------------------
aoqi@0 415 # Debug flags
aoqi@0 416
aoqi@0 417 ifeq ($(USE_CLANG), true)
aoqi@0 418 # Restrict the debug information created by Clang to avoid
aoqi@0 419 # too big object files and speed the build up a little bit
aoqi@0 420 # (see http://llvm.org/bugs/show_bug.cgi?id=7554)
aoqi@0 421 CFLAGS += -flimit-debug-info
aoqi@0 422 endif
aoqi@0 423
aoqi@0 424 # DEBUG_BINARIES uses full -g debug information for all configs
aoqi@0 425 ifeq ($(DEBUG_BINARIES), true)
aoqi@0 426 CFLAGS += -g
aoqi@0 427 else
aoqi@0 428 # Use the stabs format for debugging information (this is the default
aoqi@0 429 # on gcc-2.91). It's good enough, has all the information about line
aoqi@0 430 # numbers and local variables, and libjvm.so is only about 16M.
aoqi@0 431 # Change this back to "-g" if you want the most expressive format.
aoqi@0 432 # (warning: that could easily inflate libjvm.so to 150M!)
aoqi@0 433 # Note: The Itanium gcc compiler crashes when using -gstabs.
aoqi@0 434 DEBUG_CFLAGS/ia64 = -g
aoqi@0 435 DEBUG_CFLAGS/amd64 = -g
aoqi@0 436 DEBUG_CFLAGS/arm = -g
aoqi@0 437 DEBUG_CFLAGS/ppc = -g
aoqi@0 438 DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
aoqi@0 439 ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
aoqi@0 440 DEBUG_CFLAGS += -gstabs
aoqi@0 441 endif
aoqi@0 442
aoqi@0 443 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
aoqi@0 444 FASTDEBUG_CFLAGS/ia64 = -g
aoqi@0 445 FASTDEBUG_CFLAGS/amd64 = -g
aoqi@0 446 FASTDEBUG_CFLAGS/arm = -g
aoqi@0 447 FASTDEBUG_CFLAGS/ppc = -g
aoqi@0 448 FASTDEBUG_CFLAGS += $(FASTDEBUG_CFLAGS/$(BUILDARCH))
aoqi@0 449 ifeq ($(FASTDEBUG_CFLAGS/$(BUILDARCH)),)
aoqi@0 450 ifeq ($(USE_CLANG), true)
aoqi@0 451 # Clang doesn't understand -gstabs
aoqi@0 452 FASTDEBUG_CFLAGS += -g
aoqi@0 453 else
aoqi@0 454 FASTDEBUG_CFLAGS += -gstabs
aoqi@0 455 endif
aoqi@0 456 endif
aoqi@0 457
aoqi@0 458 OPT_CFLAGS/ia64 = -g
aoqi@0 459 OPT_CFLAGS/amd64 = -g
aoqi@0 460 OPT_CFLAGS/arm = -g
aoqi@0 461 OPT_CFLAGS/ppc = -g
aoqi@0 462 OPT_CFLAGS += $(OPT_CFLAGS/$(BUILDARCH))
aoqi@0 463 ifeq ($(OPT_CFLAGS/$(BUILDARCH)),)
aoqi@0 464 ifeq ($(USE_CLANG), true)
aoqi@0 465 # Clang doesn't understand -gstabs
aoqi@0 466 OPT_CFLAGS += -g
aoqi@0 467 else
aoqi@0 468 OPT_CFLAGS += -gstabs
aoqi@0 469 endif
aoqi@0 470 endif
aoqi@0 471 endif
aoqi@0 472 endif
aoqi@0 473
aoqi@0 474 # If we are building HEADLESS, pass on to VM
aoqi@0 475 # so it can set the java.awt.headless property
aoqi@0 476 ifdef HEADLESS
aoqi@0 477 CFLAGS += -DHEADLESS
aoqi@0 478 endif
aoqi@0 479
aoqi@0 480 # We are building Embedded for a small device
aoqi@0 481 # favor code space over speed
aoqi@0 482 ifdef MINIMIZE_RAM_USAGE
aoqi@0 483 CFLAGS += -DMINIMIZE_RAM_USAGE
aoqi@0 484 endif

mercurial