From 4ac6ef0086ca365cb6607cc6a16b4f914b8e2342 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 8 Mar 2022 10:41:26 -0800 Subject: [PATCH] Fix SAMD51 builds on GCC11.2 Fixes #5351 --- ports/atmel-samd/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index b9bc363448..b529751f7f 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -197,7 +197,11 @@ CFLAGS += \ -DSAM_D5X_E5X -DSAME51 endif - +# GCC 11 adds stringop bounds checks that trigger when writing a memory region +# we know is ok. It's not clear how to give the compiler the info it needs so +# disable the checks for now. +# See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578 +CFLAGS += -Wno-stringop-overread -Wno-stringop-overflow LDFLAGS = $(CFLAGS) -nostartfiles -Wl,-nostdlib -Wl,-T,$(GENERATED_LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nano.specs LDFLAGS += -flto=$(shell $(NPROC))