make/solaris/makefiles/gcc.make

Wed, 16 Dec 2009 12:54:49 -0500

author
phh
date
Wed, 16 Dec 2009 12:54:49 -0500
changeset 1558
167c2986d91b
parent 631
d1605aabd0a1
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6843629: Make current hotspot build part of jdk5 control build
Summary: Source changes for older compilers plus makefile changes.
Reviewed-by: xlu

duke@435 1 #
xdono@631 2 # Copyright 1998-2008 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 Compiler = gcc
duke@435 33
duke@435 34 # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
duke@435 35 # prints the numbers (e.g. "2.95", "3.2.1")
duke@435 36 CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
duke@435 37 CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
duke@435 38
duke@435 39 # Check for the versions of C++ and C compilers ($CPP and $CC) used.
duke@435 40
duke@435 41 # Get the last thing on the line that looks like x.x+ (x is a digit).
duke@435 42 COMPILER_REV := \
duke@435 43 $(shell $(CPP) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
duke@435 44 C_COMPILER_REV := \
duke@435 45 $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
duke@435 46
duke@435 47
duke@435 48 # check for precompiled headers support
duke@435 49 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
duke@435 50 USE_PRECOMPILED_HEADER=1
duke@435 51 PRECOMPILED_HEADER_DIR=.
duke@435 52 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/incls/_precompiled.incl.gch
duke@435 53 endif
duke@435 54
duke@435 55
duke@435 56 #------------------------------------------------------------------------
duke@435 57 # Compiler flags
duke@435 58
duke@435 59 # position-independent code
duke@435 60 PICFLAG = -fPIC
duke@435 61
duke@435 62 VM_PICFLAG/LIBJVM = $(PICFLAG)
duke@435 63 VM_PICFLAG/AOUT =
duke@435 64 VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO))
duke@435 65
duke@435 66 CFLAGS += $(VM_PICFLAG)
duke@435 67 CFLAGS += -fno-rtti
duke@435 68 CFLAGS += -fno-exceptions
duke@435 69 CFLAGS += -D_REENTRANT
duke@435 70 CFLAGS += -fcheck-new
duke@435 71
duke@435 72 ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
duke@435 73
duke@435 74 ARCHFLAG/sparc = -m32 -mcpu=v9
duke@435 75 ARCHFLAG/sparcv9 = -m64 -mcpu=v9
duke@435 76 ARCHFLAG/i486 = -m32 -march=i586
duke@435 77 ARCHFLAG/amd64 = -m64 -march=k8
duke@435 78
duke@435 79
duke@435 80 # Optional sub-directory in /usr/lib where BUILDARCH libraries are kept.
duke@435 81 ISA_DIR=$(ISA_DIR/$(BUILDARCH))
duke@435 82 ISA_DIR/amd64=/amd64
duke@435 83 ISA_DIR/i486=
duke@435 84 ISA_DIR/sparcv9=/64
duke@435 85
duke@435 86
duke@435 87 CFLAGS += $(ARCHFLAG)
duke@435 88 AOUT_FLAGS += $(ARCHFLAG)
duke@435 89 LFLAGS += $(ARCHFLAG)
duke@435 90 ASFLAGS += $(ARCHFLAG)
duke@435 91
duke@435 92 ifeq ($(BUILDARCH), amd64)
duke@435 93 ASFLAGS += -march=k8 -march=amd64
duke@435 94 LFLAGS += -march=k8
duke@435 95 endif
duke@435 96
duke@435 97
duke@435 98 # Use C++ Interpreter
duke@435 99 ifdef CC_INTERP
duke@435 100 CFLAGS += -DCC_INTERP
duke@435 101 endif
duke@435 102
duke@435 103 # Keep temporary files (.ii, .s)
duke@435 104 ifdef NEED_ASM
duke@435 105 CFLAGS += -save-temps
duke@435 106 else
duke@435 107 CFLAGS += -pipe
duke@435 108 endif
duke@435 109
duke@435 110
duke@435 111 # Compiler warnings are treated as errors
duke@435 112 WARNINGS_ARE_ERRORS = -Werror
duke@435 113 # Enable these warnings. See 'info gcc' about details on these options
duke@435 114 ADDITIONAL_WARNINGS = -Wpointer-arith -Wconversion -Wsign-compare
duke@435 115 CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ADDITIONAL_WARNINGS)
duke@435 116 # Special cases
duke@435 117 CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@))
duke@435 118
duke@435 119 # The flags to use for an Optimized g++ build
duke@435 120 OPT_CFLAGS += -O3
duke@435 121
duke@435 122 # Hotspot uses very unstrict aliasing turn this optimization off
duke@435 123 OPT_CFLAGS += -fno-strict-aliasing
duke@435 124
duke@435 125 # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp
duke@435 126 # if we use expensive-optimizations
duke@435 127 # Note: all ia64 setting reflect the ones for linux
duke@435 128 # No actial testing was performed: there is no Solaris on ia64 presently
duke@435 129 ifeq ($(BUILDARCH), ia64)
duke@435 130 OPT_CFLAGS/bytecodeInterpreter.o += -fno-expensive-optimizations
duke@435 131 endif
duke@435 132
duke@435 133 OPT_CFLAGS/NOOPT=-O0
duke@435 134 #------------------------------------------------------------------------
duke@435 135 # Linker flags
duke@435 136
duke@435 137 # statically link libstdc++.so, work with gcc but ignored by g++
duke@435 138 STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
duke@435 139
duke@435 140 # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
duke@435 141 ifneq ("${CC_VER_MAJOR}", "2")
duke@435 142 STATIC_LIBGCC += -static-libgcc
duke@435 143 endif
duke@435 144
duke@435 145 ifeq ($(BUILDARCH), ia64)
duke@435 146 # Note: all ia64 setting reflect the ones for linux
duke@435 147 # No actial testing was performed: there is no Solaris on ia64 presently
duke@435 148 LFLAGS += -Wl,-relax
duke@435 149 endif
duke@435 150
duke@435 151 ifdef USE_GNULD
duke@435 152 # Enable linker optimization
duke@435 153 LFLAGS += -Xlinker -O1
duke@435 154
duke@435 155 # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
duke@435 156 MAPFLAG = -Xlinker --version-script=FILENAME
duke@435 157 else
duke@435 158 MAPFLAG = -Xlinker -M -Xlinker FILENAME
duke@435 159 endif
duke@435 160
duke@435 161 # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
duke@435 162 SONAMEFLAG = -Xlinker -soname=SONAME
duke@435 163
duke@435 164 # Build shared library
duke@435 165 SHARED_FLAG = -shared
duke@435 166
duke@435 167 #------------------------------------------------------------------------
duke@435 168 # Debug flags
duke@435 169
duke@435 170 # Use the stabs format for debugging information (this is the default
duke@435 171 # on gcc-2.91). It's good enough, has all the information about line
duke@435 172 # numbers and local variables, and libjvm_g.so is only about 16M.
duke@435 173 # Change this back to "-g" if you want the most expressive format.
duke@435 174 # (warning: that could easily inflate libjvm_g.so to 150M!)
duke@435 175 # Note: The Itanium gcc compiler crashes when using -gstabs.
duke@435 176 DEBUG_CFLAGS/ia64 = -g
duke@435 177 DEBUG_CFLAGS/amd64 = -g
duke@435 178 DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
duke@435 179 ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
duke@435 180 DEBUG_CFLAGS += -gstabs
duke@435 181 endif
duke@435 182
duke@435 183 MCS = /usr/ccs/bin/mcs

mercurial