build/linux/makefiles/gcc.make

changeset 435
a61af66fc99e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/build/linux/makefiles/gcc.make	Sat Dec 01 00:00:00 2007 +0000
     1.3 @@ -0,0 +1,158 @@
     1.4 +#
     1.5 +# Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
     1.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 +#
     1.8 +# This code is free software; you can redistribute it and/or modify it
     1.9 +# under the terms of the GNU General Public License version 2 only, as
    1.10 +# published by the Free Software Foundation.
    1.11 +#
    1.12 +# This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 +# version 2 for more details (a copy is included in the LICENSE file that
    1.16 +# accompanied this code).
    1.17 +#
    1.18 +# You should have received a copy of the GNU General Public License version
    1.19 +# 2 along with this work; if not, write to the Free Software Foundation,
    1.20 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 +#
    1.22 +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    1.23 +# CA 95054 USA or visit www.sun.com if you need additional information or
    1.24 +# have any questions.
    1.25 +#  
    1.26 +#
    1.27 +
    1.28 +#------------------------------------------------------------------------
    1.29 +# CC, CPP & AS
    1.30 +
    1.31 +CPP = g++
    1.32 +CC  = gcc
    1.33 +AS  = $(CC) -c
    1.34 +
    1.35 +# -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
    1.36 +# prints the numbers (e.g. "2.95", "3.2.1")
    1.37 +CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
    1.38 +CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
    1.39 +
    1.40 +# check for precompiled headers support
    1.41 +ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
    1.42 +USE_PRECOMPILED_HEADER=1
    1.43 +PRECOMPILED_HEADER_DIR=.
    1.44 +PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/incls/_precompiled.incl.gch
    1.45 +endif
    1.46 +
    1.47 +
    1.48 +#------------------------------------------------------------------------
    1.49 +# Compiler flags
    1.50 +
    1.51 +# position-independent code
    1.52 +PICFLAG = -fPIC
    1.53 +
    1.54 +VM_PICFLAG/LIBJVM = $(PICFLAG)
    1.55 +VM_PICFLAG/AOUT   =
    1.56 +
    1.57 +ifneq ($(BUILDARCH), i486)
    1.58 +VM_PICFLAG        = $(VM_PICFLAG/$(LINK_INTO))
    1.59 +else
    1.60 +# PIC has significant overhead on x86, build nonpic VM for now.
    1.61 +# Link JVM at a "good" base location to avoid unnecessary .text patching.
    1.62 +JVM_BASE_ADDR     = 0x06000000
    1.63 +endif
    1.64 +
    1.65 +CFLAGS += $(VM_PICFLAG)
    1.66 +CFLAGS += -fno-rtti
    1.67 +CFLAGS += -fno-exceptions
    1.68 +CFLAGS += -D_REENTRANT
    1.69 +CFLAGS += -fcheck-new
    1.70 +
    1.71 +ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
    1.72 +ARCHFLAG/i486    = -m32 -march=i586
    1.73 +ARCHFLAG/amd64   = -m64
    1.74 +ARCHFLAG/ia64    =
    1.75 +ARCHFLAG/sparc   = -m32 -mcpu=v9
    1.76 +ARCHFLAG/sparcv9 = -m64 -mcpu=v9
    1.77 +
    1.78 +CFLAGS     += $(ARCHFLAG)
    1.79 +AOUT_FLAGS += $(ARCHFLAG)
    1.80 +LFLAGS     += $(ARCHFLAG)
    1.81 +ASFLAGS    += $(ARCHFLAG)
    1.82 +
    1.83 +# Use C++ Interpreter
    1.84 +ifdef CC_INTERP
    1.85 +  CFLAGS += -DCC_INTERP
    1.86 +endif
    1.87 +
    1.88 +# Keep temporary files (.ii, .s)
    1.89 +ifdef NEED_ASM
    1.90 +  CFLAGS += -save-temps
    1.91 +else
    1.92 +  CFLAGS += -pipe
    1.93 +endif
    1.94 +
    1.95 +# Compiler warnings are treated as errors
    1.96 +WARNINGS_ARE_ERRORS = -Werror
    1.97 +# Except for a few acceptable ones
    1.98 +ACCEPTABLE_WARNINGS = -Wpointer-arith -Wconversion -Wsign-compare
    1.99 +CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ACCEPTABLE_WARNINGS)
   1.100 +# Special cases
   1.101 +CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) 
   1.102 +
   1.103 +# The flags to use for an Optimized g++ build
   1.104 +OPT_CFLAGS += -O3
   1.105 +
   1.106 +# Hotspot uses very unstrict aliasing turn this optimization off
   1.107 +OPT_CFLAGS += -fno-strict-aliasing
   1.108 +
   1.109 +# The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp 
   1.110 +# if we use expensive-optimizations
   1.111 +ifeq ($(BUILDARCH), ia64)
   1.112 +OPT_CFLAGS += -fno-expensive-optimizations
   1.113 +endif
   1.114 +
   1.115 +OPT_CFLAGS/NOOPT=-O0
   1.116 +
   1.117 +#------------------------------------------------------------------------
   1.118 +# Linker flags
   1.119 +
   1.120 +# statically link libstdc++.so, work with gcc but ignored by g++
   1.121 +STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
   1.122 +
   1.123 +# statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
   1.124 +ifneq ("${CC_VER_MAJOR}", "2")
   1.125 +STATIC_LIBGCC += -static-libgcc
   1.126 +endif
   1.127 +
   1.128 +ifeq ($(BUILDARCH), ia64)
   1.129 +LFLAGS += -Wl,-relax
   1.130 +endif
   1.131 +
   1.132 +# Enable linker optimization
   1.133 +LFLAGS += -Xlinker -O1
   1.134 +
   1.135 +# Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
   1.136 +MAPFLAG = -Xlinker --version-script=FILENAME
   1.137 +
   1.138 +# Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
   1.139 +SONAMEFLAG = -Xlinker -soname=SONAME
   1.140 +
   1.141 +# Build shared library
   1.142 +SHARED_FLAG = -shared
   1.143 +
   1.144 +# Keep symbols even they are not used
   1.145 +AOUT_FLAGS += -export-dynamic
   1.146 +
   1.147 +#------------------------------------------------------------------------
   1.148 +# Debug flags
   1.149 +
   1.150 +# Use the stabs format for debugging information (this is the default
   1.151 +# on gcc-2.91). It's good enough, has all the information about line
   1.152 +# numbers and local variables, and libjvm_g.so is only about 16M.
   1.153 +# Change this back to "-g" if you want the most expressive format.
   1.154 +# (warning: that could easily inflate libjvm_g.so to 150M!)
   1.155 +# Note: The Itanium gcc compiler crashes when using -gstabs.
   1.156 +DEBUG_CFLAGS/ia64  = -g
   1.157 +DEBUG_CFLAGS/amd64 = -g
   1.158 +DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
   1.159 +ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
   1.160 +DEBUG_CFLAGS += -gstabs
   1.161 +endif

mercurial