diff --git a/cpu/esp8266/Makefile.include b/cpu/esp8266/Makefile.include index e700943bddad..daa32a61cd6d 100644 --- a/cpu/esp8266/Makefile.include +++ b/cpu/esp8266/Makefile.include @@ -52,5 +52,3 @@ LINKFLAGS += -Tesp8266.peripherals.ld LINKFLAGS += -Wl,-wrap=pp_attach LINKFLAGS += -Wl,-wrap=pm_attach - -OPTIONAL_CFLAGS_BLACKLIST += -fmacro-prefix-map=$(RIOTBASE)/= diff --git a/makefiles/arch/avr8.inc.mk b/makefiles/arch/avr8.inc.mk index c51c07610058..ef55b40af316 100644 --- a/makefiles/arch/avr8.inc.mk +++ b/makefiles/arch/avr8.inc.mk @@ -38,7 +38,6 @@ endif OPTIONAL_CFLAGS_BLACKLIST += -Wformat-overflow OPTIONAL_CFLAGS_BLACKLIST += -Wformat-truncation OPTIONAL_CFLAGS_BLACKLIST += -gz -OPTIONAL_CFLAGS_BLACKLIST += -fmacro-prefix-map=$(RIOTBASE)/= ifeq ($(TOOLCHAIN),gnu) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523 diff --git a/makefiles/toolchain/gnu.inc.mk b/makefiles/toolchain/gnu.inc.mk index 74e2120473e9..7f94a8d92f32 100644 --- a/makefiles/toolchain/gnu.inc.mk +++ b/makefiles/toolchain/gnu.inc.mk @@ -22,5 +22,13 @@ endif # Default to the native (g)objdump, helps when using toolchain from docker _OBJDUMP := $(or $(shell command -v $(PREFIX)objdump || command -v gobjdump),objdump) OBJDUMP ?= $(_OBJDUMP) + +GCC_VERSION := $(shell $(CC) -dumpversion | cut -d . -f 1) + +# -fmacro-prefix-map requires GCC 8 +ifneq (8, $(firstword $(shell echo 8 $(GCC_VERSION) | tr ' ' '\n' | sort -n)))) + OPTIONAL_CFLAGS_BLACKLIST += -fmacro-prefix-map=$(RIOTBASE)/= +endif + # We use GDB for debugging include $(RIOTMAKE)/tools/gdb.inc.mk