make/linux/makefiles/gcc.make

Tue, 13 Oct 2009 12:04:21 -0700

author
never
date
Tue, 13 Oct 2009 12:04:21 -0700
changeset 1445
354d3184f6b2
parent 1205
f5ee65f94d9a
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6890308: integrate zero assembler hotspot changes
Reviewed-by: never
Contributed-by: gbenson@redhat.com

duke@435 1 #
xdono@1014 2 # Copyright 1999-2009 Sun Microsystems, Inc. All Rights Reserved.
duke@435 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 #
duke@435 5 # This code is free software; you can redistribute it and/or modify it
duke@435 6 # under the terms of the GNU General Public License version 2 only, as
duke@435 7 # published by the Free Software Foundation.
duke@435 8 #
duke@435 9 # This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 # version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 # accompanied this code).
duke@435 14 #
duke@435 15 # You should have received a copy of the GNU General Public License version
duke@435 16 # 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 #
duke@435 19 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@435 20 # CA 95054 USA or visit www.sun.com if you need additional information or
duke@435 21 # have any questions.
duke@435 22 #
duke@435 23 #
duke@435 24
duke@435 25 #------------------------------------------------------------------------
duke@435 26 # CC, CPP & AS
duke@435 27
duke@435 28 CPP = g++
duke@435 29 CC = gcc
duke@435 30 AS = $(CC) -c
duke@435 31
duke@435 32 # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
duke@435 33 # prints the numbers (e.g. "2.95", "3.2.1")
duke@435 34 CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
duke@435 35 CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
duke@435 36
duke@435 37 # check for precompiled headers support
duke@435 38 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
duke@435 39 USE_PRECOMPILED_HEADER=1
duke@435 40 PRECOMPILED_HEADER_DIR=.
duke@435 41 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/incls/_precompiled.incl.gch
duke@435 42 endif
duke@435 43
duke@435 44
duke@435 45 #------------------------------------------------------------------------
duke@435 46 # Compiler flags
duke@435 47
duke@435 48 # position-independent code
duke@435 49 PICFLAG = -fPIC
duke@435 50
duke@435 51 VM_PICFLAG/LIBJVM = $(PICFLAG)
duke@435 52 VM_PICFLAG/AOUT =
duke@435 53 VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO))
duke@435 54
never@1445 55 ifeq ($(ZERO_BUILD), true)
never@1445 56 CFLAGS += $(LIBFFI_CFLAGS)
never@1445 57 endif
duke@435 58 CFLAGS += $(VM_PICFLAG)
duke@435 59 CFLAGS += -fno-rtti
duke@435 60 CFLAGS += -fno-exceptions
duke@435 61 CFLAGS += -D_REENTRANT
duke@435 62 CFLAGS += -fcheck-new
duke@435 63
duke@435 64 ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
duke@435 65 ARCHFLAG/i486 = -m32 -march=i586
duke@435 66 ARCHFLAG/amd64 = -m64
duke@435 67 ARCHFLAG/ia64 =
duke@435 68 ARCHFLAG/sparc = -m32 -mcpu=v9
duke@435 69 ARCHFLAG/sparcv9 = -m64 -mcpu=v9
never@1445 70 ARCHFLAG/zero = $(ZERO_ARCHFLAG)
duke@435 71
duke@435 72 CFLAGS += $(ARCHFLAG)
duke@435 73 AOUT_FLAGS += $(ARCHFLAG)
duke@435 74 LFLAGS += $(ARCHFLAG)
duke@435 75 ASFLAGS += $(ARCHFLAG)
duke@435 76
duke@435 77 # Use C++ Interpreter
duke@435 78 ifdef CC_INTERP
duke@435 79 CFLAGS += -DCC_INTERP
duke@435 80 endif
duke@435 81
duke@435 82 # Keep temporary files (.ii, .s)
duke@435 83 ifdef NEED_ASM
duke@435 84 CFLAGS += -save-temps
duke@435 85 else
duke@435 86 CFLAGS += -pipe
duke@435 87 endif
duke@435 88
duke@435 89 # Compiler warnings are treated as errors
duke@435 90 WARNINGS_ARE_ERRORS = -Werror
xlu@664 91
duke@435 92 # Except for a few acceptable ones
xlu@664 93 # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
xlu@664 94 # conversions which might affect the values. To avoid that, we need to turn
xlu@664 95 # it off explicitly.
xlu@664 96 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
xlu@664 97 ACCEPTABLE_WARNINGS = -Wpointer-arith -Wsign-compare
xlu@664 98 else
duke@435 99 ACCEPTABLE_WARNINGS = -Wpointer-arith -Wconversion -Wsign-compare
xlu@664 100 endif
xlu@664 101
duke@435 102 CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ACCEPTABLE_WARNINGS)
duke@435 103 # Special cases
duke@435 104 CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@))
duke@435 105
duke@435 106 # The flags to use for an Optimized g++ build
duke@435 107 OPT_CFLAGS += -O3
duke@435 108
duke@435 109 # Hotspot uses very unstrict aliasing turn this optimization off
duke@435 110 OPT_CFLAGS += -fno-strict-aliasing
duke@435 111
duke@435 112 # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp
duke@435 113 # if we use expensive-optimizations
duke@435 114 ifeq ($(BUILDARCH), ia64)
duke@435 115 OPT_CFLAGS += -fno-expensive-optimizations
duke@435 116 endif
duke@435 117
duke@435 118 OPT_CFLAGS/NOOPT=-O0
duke@435 119
kvn@1179 120 # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation.
kvn@1179 121 ifneq "$(shell expr \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) = 3 \) \))" "0"
kvn@1179 122 OPT_CFLAGS/mulnode.o += -O0
kvn@1179 123 endif
kvn@1179 124
duke@435 125 #------------------------------------------------------------------------
duke@435 126 # Linker flags
duke@435 127
duke@435 128 # statically link libstdc++.so, work with gcc but ignored by g++
duke@435 129 STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
duke@435 130
duke@435 131 # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
duke@435 132 ifneq ("${CC_VER_MAJOR}", "2")
duke@435 133 STATIC_LIBGCC += -static-libgcc
duke@435 134 endif
duke@435 135
duke@435 136 ifeq ($(BUILDARCH), ia64)
duke@435 137 LFLAGS += -Wl,-relax
duke@435 138 endif
duke@435 139
duke@435 140 # Enable linker optimization
duke@435 141 LFLAGS += -Xlinker -O1
duke@435 142
ohair@1011 143 # If this is a --hash-style=gnu system, use --hash-style=both
ohair@1011 144 # The gnu .hash section won't work on some Linux systems like SuSE 10.
ohair@1011 145 _HAS_HASH_STYLE_GNU:=$(shell $(CC) -dumpspecs | grep -- '--hash-style=gnu')
ohair@1011 146 ifneq ($(_HAS_HASH_STYLE_GNU),)
ohair@1011 147 LDFLAGS_HASH_STYLE = -Wl,--hash-style=both
ohair@1011 148 endif
ohair@1011 149 LFLAGS += $(LDFLAGS_HASH_STYLE)
ohair@1011 150
duke@435 151 # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
duke@435 152 MAPFLAG = -Xlinker --version-script=FILENAME
duke@435 153
duke@435 154 # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
duke@435 155 SONAMEFLAG = -Xlinker -soname=SONAME
duke@435 156
duke@435 157 # Build shared library
duke@435 158 SHARED_FLAG = -shared
duke@435 159
duke@435 160 # Keep symbols even they are not used
duke@435 161 AOUT_FLAGS += -export-dynamic
duke@435 162
duke@435 163 #------------------------------------------------------------------------
duke@435 164 # Debug flags
duke@435 165
duke@435 166 # Use the stabs format for debugging information (this is the default
duke@435 167 # on gcc-2.91). It's good enough, has all the information about line
duke@435 168 # numbers and local variables, and libjvm_g.so is only about 16M.
duke@435 169 # Change this back to "-g" if you want the most expressive format.
duke@435 170 # (warning: that could easily inflate libjvm_g.so to 150M!)
duke@435 171 # Note: The Itanium gcc compiler crashes when using -gstabs.
duke@435 172 DEBUG_CFLAGS/ia64 = -g
duke@435 173 DEBUG_CFLAGS/amd64 = -g
duke@435 174 DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
duke@435 175 ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
duke@435 176 DEBUG_CFLAGS += -gstabs
duke@435 177 endif
aph@1202 178
aph@1202 179 # DEBUG_BINARIES overrides everything, use full -g debug information
aph@1202 180 ifeq ($(DEBUG_BINARIES), true)
aph@1202 181 DEBUG_CFLAGS = -g
aph@1202 182 CFLAGS += $(DEBUG_CFLAGS)
aph@1202 183 endif

mercurial