diff -Nru openjdk.orig/corba/make/common/shared/Compiler-gcc.gmk openjdk/corba/make/common/shared/Compiler-gcc.gmk
--- openjdk.orig/corba/make/common/shared/Compiler-gcc.gmk	2012-05-01 22:14:04.000000000 +0100
+++ openjdk/corba/make/common/shared/Compiler-gcc.gmk	2012-08-31 14:23:49.777791536 +0100
@@ -58,17 +58,17 @@
 ifeq ($(PLATFORM), linux)
 
   # Settings specific to Linux
-  CC             = $(COMPILER_PATH)gcc
-  CPP            = $(COMPILER_PATH)gcc -E
+  CC             = $(COMPILER_PATH)gcc$(GCC_SUFFIX)
+  CPP            = $(COMPILER_PATH)gcc$(GCC_SUFFIX) -E
   # statically link libstdc++ before C++ ABI is stablized on Linux
   STATIC_CXX     = true
   ifeq ($(STATIC_CXX),true)
     # g++ always dynamically links libstdc++, even we use "-Wl,-Bstatic -lstdc++"
     # We need to use gcc to statically link the C++ runtime. gcc and g++ use
     # the same subprocess to compile C++ files, so it is OK to build using gcc.
-    CXX            = $(COMPILER_PATH)gcc
+    CXX            = $(COMPILER_PATH)gcc$(GCC_SUFFIX)
   else
-    CXX            = $(COMPILER_PATH)g++
+    CXX            = $(COMPILER_PATH)g++$(GCC_SUFFIX)
   endif
   ifeq ($(ZERO_BUILD), true)
     # zero
diff -Nru openjdk.orig/jdk/make/common/shared/Compiler-gcc.gmk openjdk/jdk/make/common/shared/Compiler-gcc.gmk
--- openjdk.orig/jdk/make/common/shared/Compiler-gcc.gmk	2012-05-01 22:17:59.000000000 +0100
+++ openjdk/jdk/make/common/shared/Compiler-gcc.gmk	2012-08-31 14:23:17.241256083 +0100
@@ -58,17 +58,17 @@
 ifeq ($(PLATFORM), linux)
 
   # Settings specific to Linux
-  CC             = $(COMPILER_PATH)gcc
-  CPP            = $(COMPILER_PATH)gcc -E
+  CC             = $(COMPILER_PATH)gcc$(GCC_SUFFIX)
+  CPP            = $(COMPILER_PATH)gcc$(GCC_SUFFIX) -E
   # statically link libstdc++ before C++ ABI is stablized on Linux
   STATIC_CXX     = true
   ifeq ($(STATIC_CXX),true)
     # g++ always dynamically links libstdc++, even we use "-Wl,-Bstatic -lstdc++"
     # We need to use gcc to statically link the C++ runtime. gcc and g++ use
     # the same subprocess to compile C++ files, so it is OK to build using gcc.
-    CXX            = $(COMPILER_PATH)gcc
+    CXX            = $(COMPILER_PATH)gcc$(GCC_SUFFIX)
   else
-    CXX            = $(COMPILER_PATH)g++
+    CXX            = $(COMPILER_PATH)g++$(GCC_SUFFIX)
   endif
   ifneq ("$(findstring sparc,$(ARCH))", "")
     # sparc or sparcv9
