make/linux/makefiles/gcc.make

Print this page




  27 
  28 ifdef ALT_COMPILER_PATH
  29 CPP = $(ALT_COMPILER_PATH)/g++
  30 CC  = $(ALT_COMPILER_PATH)/gcc
  31 else
  32 CPP = g++
  33 CC  = gcc
  34 endif
  35 
  36 AS  = $(CC) -c
  37 
  38 # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
  39 # prints the numbers (e.g. "2.95", "3.2.1")
  40 CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
  41 CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
  42 
  43 # check for precompiled headers support
  44 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
  45 USE_PRECOMPILED_HEADER=1
  46 PRECOMPILED_HEADER_DIR=.
  47 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/incls/_precompiled.incl.gch

  48 endif
  49 
  50 
  51 #------------------------------------------------------------------------
  52 # Compiler flags
  53 
  54 # position-independent code
  55 PICFLAG = -fPIC
  56 
  57 VM_PICFLAG/LIBJVM = $(PICFLAG)
  58 VM_PICFLAG/AOUT   =
  59 VM_PICFLAG        = $(VM_PICFLAG/$(LINK_INTO))
  60 
  61 ifeq ($(ZERO_BUILD), true)
  62 CFLAGS += $(LIBFFI_CFLAGS)
  63 endif
  64 ifeq ($(SHARK_BUILD), true)
  65 CFLAGS += $(LLVM_CFLAGS)
  66 endif
  67 CFLAGS += $(VM_PICFLAG)


 127 
 128 # The flags to use for an Optimized g++ build
 129 OPT_CFLAGS += -O3
 130 
 131 # Hotspot uses very unstrict aliasing turn this optimization off
 132 OPT_CFLAGS += -fno-strict-aliasing
 133 
 134 # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp 
 135 # if we use expensive-optimizations
 136 ifeq ($(BUILDARCH), ia64)
 137 OPT_CFLAGS += -fno-expensive-optimizations
 138 endif
 139 
 140 OPT_CFLAGS/NOOPT=-O0
 141 
 142 # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation. 
 143 ifneq "$(shell expr \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) = 3 \) \))" "0"
 144 OPT_CFLAGS/mulnode.o += -O0
 145 endif
 146 





 147 #------------------------------------------------------------------------
 148 # Linker flags
 149 
 150 # statically link libstdc++.so, work with gcc but ignored by g++
 151 STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
 152 
 153 # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
 154 ifneq ("${CC_VER_MAJOR}", "2")
 155 STATIC_LIBGCC += -static-libgcc
 156 endif
 157 
 158 ifeq ($(BUILDARCH), ia64)
 159 LFLAGS += -Wl,-relax
 160 endif
 161 
 162 # Enable linker optimization
 163 LFLAGS += -Xlinker -O1
 164 
 165 # If this is a --hash-style=gnu system, use --hash-style=both
 166 #   The gnu .hash section won't work on some Linux systems like SuSE 10.




  27 
  28 ifdef ALT_COMPILER_PATH
  29 CPP = $(ALT_COMPILER_PATH)/g++
  30 CC  = $(ALT_COMPILER_PATH)/gcc
  31 else
  32 CPP = g++
  33 CC  = gcc
  34 endif
  35 
  36 AS  = $(CC) -c
  37 
  38 # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
  39 # prints the numbers (e.g. "2.95", "3.2.1")
  40 CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
  41 CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
  42 
  43 # check for precompiled headers support
  44 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
  45 USE_PRECOMPILED_HEADER=1
  46 PRECOMPILED_HEADER_DIR=.
  47 PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled.hpp
  48 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
  49 endif
  50 
  51 
  52 #------------------------------------------------------------------------
  53 # Compiler flags
  54 
  55 # position-independent code
  56 PICFLAG = -fPIC
  57 
  58 VM_PICFLAG/LIBJVM = $(PICFLAG)
  59 VM_PICFLAG/AOUT   =
  60 VM_PICFLAG        = $(VM_PICFLAG/$(LINK_INTO))
  61 
  62 ifeq ($(ZERO_BUILD), true)
  63 CFLAGS += $(LIBFFI_CFLAGS)
  64 endif
  65 ifeq ($(SHARK_BUILD), true)
  66 CFLAGS += $(LLVM_CFLAGS)
  67 endif
  68 CFLAGS += $(VM_PICFLAG)


 128 
 129 # The flags to use for an Optimized g++ build
 130 OPT_CFLAGS += -O3
 131 
 132 # Hotspot uses very unstrict aliasing turn this optimization off
 133 OPT_CFLAGS += -fno-strict-aliasing
 134 
 135 # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp 
 136 # if we use expensive-optimizations
 137 ifeq ($(BUILDARCH), ia64)
 138 OPT_CFLAGS += -fno-expensive-optimizations
 139 endif
 140 
 141 OPT_CFLAGS/NOOPT=-O0
 142 
 143 # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation. 
 144 ifneq "$(shell expr \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) = 3 \) \))" "0"
 145 OPT_CFLAGS/mulnode.o += -O0
 146 endif
 147 
 148 # Flags for generating make dependency flags.
 149 ifneq ("${CC_VER_MAJOR}", "2")
 150 DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
 151 endif
 152 
 153 #------------------------------------------------------------------------
 154 # Linker flags
 155 
 156 # statically link libstdc++.so, work with gcc but ignored by g++
 157 STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
 158 
 159 # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
 160 ifneq ("${CC_VER_MAJOR}", "2")
 161 STATIC_LIBGCC += -static-libgcc
 162 endif
 163 
 164 ifeq ($(BUILDARCH), ia64)
 165 LFLAGS += -Wl,-relax
 166 endif
 167 
 168 # Enable linker optimization
 169 LFLAGS += -Xlinker -O1
 170 
 171 # If this is a --hash-style=gnu system, use --hash-style=both
 172 #   The gnu .hash section won't work on some Linux systems like SuSE 10.