diff --git a/Makefile.gcc b/Makefile.gcc
index 03efaa3be910544b722f1699430725dd18c37d58..5fb430dda30d9726524aa1dc6a010a39e3cd41cc 100644
--- a/Makefile.gcc
+++ b/Makefile.gcc
@@ -3,8 +3,9 @@
 # GCC specific definitions and actions
 #
 
-GCC_MAJOR_VERSION := $(shell $(CC) -dumpversion | cut -d "." -f 1)
-GCC_MINOR_VERSION := $(shell $(CC) -dumpversion | cut -d "." -f 2)
+GCC_VERSION := $(shell $(CC) -dumpfullversion -dumpversion)
+GCC_MAJOR_VERSION := $(word 1,$(subst ., ,$(GCC_VERSION)))
+GCC_MINOR_VERSION := $(word 2,$(subst ., ,$(GCC_VERSION)))
 
 # Warn if using version 6.3.x of arm-none-eabi-gcc
 ifeq ("$(CC)","arm-none-eabi-gcc")