changeset 7902:a925b0c74086

gcc versions >= 4.8 don't support -gstabs with pre-compiled headers. Just use -g for them; also factor out the code that determines if we should use -g or -gstabs in one place. ok kurt@
author Christos Zoulas <christos@zoulas.com>
date Mon, 09 May 2016 17:13:40 -0400
parents 361ef7f29332
children 43b6157a184a
files make/bsd/makefiles/gcc.make
diffstat 1 files changed, 30 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/make/bsd/makefiles/gcc.make	Sun May 01 23:35:54 2016 -0700
+++ b/make/bsd/makefiles/gcc.make	Mon May 09 17:13:40 2016 -0400
@@ -427,55 +427,43 @@
   CFLAGS += -flimit-debug-info
 endif
 
+# Use the stabs format for debugging information (this is the default
+# on gcc-2.91). It's good enough, has all the information about line
+# numbers and local variables, and libjvm.so is only about 16M.
+# Change this back to "-g" if you want the most expressive format.
+# (warning: that could easily inflate libjvm.so to 150M!)
+# Note: The Itanium gcc compiler crashes when using -gstabs.
+# Don't use stabs on gcc>=4.8 because it is incompatible with
+# pre-compiled-headers
+ifeq ($(USE_CLANG), true)
+  # Clang doesn't understand -gstabs
+  STABS_CFLAGS += -g
+else
+  ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 8 \) \))" "1"
+    # GCC >= 4.8
+    STABS_CFLAGS += -g
+  else
+    STABS_CFLAGS/ia64  = -g
+    STABS_CFLAGS/arm   = -g
+    STABS_CFLAGS/ppc   = -g
+    ifeq ($(STABS_CFLAGS/$(BUILDARCH)),)
+      STABS_CFLAGS += -gstabs
+    else
+      STABS_CFLAGS += $(STABS_CFLAGS/$(BUILDARCH))
+    endif
+  endif
+endif
+
 # DEBUG_BINARIES uses full -g debug information for all configs
 ifeq ($(DEBUG_BINARIES), true)
   CFLAGS += -g
 else
-  # Use the stabs format for debugging information (this is the default
-  # on gcc-2.91). It's good enough, has all the information about line
-  # numbers and local variables, and libjvm.so is only about 16M.
-  # Change this back to "-g" if you want the most expressive format.
-  # (warning: that could easily inflate libjvm.so to 150M!)
-  # Note: The Itanium gcc compiler crashes when using -gstabs.
-  DEBUG_CFLAGS/ia64  = -g
-  DEBUG_CFLAGS/arm   = -g
-  DEBUG_CFLAGS/ppc   = -g
-  DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
-  ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
-      ifeq ($(USE_CLANG), true)
-        # Clang doesn't understand -gstabs
-        DEBUG_CFLAGS += -g
-      else
-        DEBUG_CFLAGS += -gstabs
-      endif
-  endif
+  DEBUG_CFLAGS += ${STABS_CFLAGS}
   
   ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-    FASTDEBUG_CFLAGS/ia64  = -g
-    FASTDEBUG_CFLAGS/arm   = -g
-    FASTDEBUG_CFLAGS/ppc   = -g
-    FASTDEBUG_CFLAGS += $(FASTDEBUG_CFLAGS/$(BUILDARCH))
-    ifeq ($(FASTDEBUG_CFLAGS/$(BUILDARCH)),)
-      ifeq ($(USE_CLANG), true)
-        # Clang doesn't understand -gstabs
-        FASTDEBUG_CFLAGS += -g
-      else
-        FASTDEBUG_CFLAGS += -gstabs
-      endif
-    endif
+    FASTDEBUG_CFLAGS += ${STABS_CFLAGS}
   
-    OPT_CFLAGS/ia64  = -g
-    OPT_CFLAGS/arm   = -g
-    OPT_CFLAGS/ppc   = -g
-    OPT_CFLAGS += $(OPT_CFLAGS/$(BUILDARCH))
-    ifeq ($(OPT_CFLAGS/$(BUILDARCH)),)
-      ifeq ($(USE_CLANG), true)
-        # Clang doesn't understand -gstabs
-        OPT_CFLAGS += -g
-      else
-        OPT_CFLAGS += -gstabs
-      endif
-    endif
+    OPT_CFLAGS += ${STABS_CFLAGS}
   endif
 endif