From 8246de86360666d81e71785c1c8be03a72563d17 Mon Sep 17 00:00:00 2001 From: Joel Stanley Date: Thu, 29 Jul 2021 17:24:38 +0930 Subject: Makefile: Avoid errors with GCC 11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GCC's string and memory functions blow up as the compiler thinks the objects have no size: core/opal-dump.c: In function ‘opal_mpipl_update’: libc/include/string.h:34:16: warning: ‘__builtin_memset’ offset [0, 32767] is out of the bounds [0, 0] [-Warray-bounds] 34 | #define memset __builtin_memset core/opal-dump.c:333:17: note: in expansion of macro ‘memset’ 333 | memset((void *)MDRT_TABLE_BASE, 0, MDRT_TABLE_SIZE); | ^~~~~~ core/opal-dump.c: In function ‘opal_mpipl_init’: libc/include/string.h:34:16: warning: ‘__builtin_memset’ offset [0, 1023] is out of the bounds [0, 0] [-Warray-bounds] 34 | #define memset __builtin_memset core/opal-dump.c:565:9: note: in expansion of macro ‘memset’ 565 | memset(mdst_base, 0, MDST_TABLE_SIZE); | ^~~~~~ libc/include/string.h:34:16: warning: ‘__builtin_memset’ offset [0, 1023] is out of the bounds [0, 0] [-Warray-bounds] 34 | #define memset __builtin_memset core/opal-dump.c:567:9: note: in expansion of macro ‘memset’ 567 | memset(mddt_base, 0, MDDT_TABLE_SIZE); | ^~~~~~ In function ‘HDIF_check’, inlined from ‘fixup_spira’ at hdata/spira.c:1679:7, inlined from ‘parse_hdat’ at hdata/spira.c:1732:2: libc/include/string.h:38:16: warning: ‘__builtin_memcmp’ specified bound 6 exceeds source size 0 [-Wstringop-overread] 38 | #define memcmp __builtin_memcmp hdata/hdif.h:71:17: note: in expansion of macro ‘memcmp’ 71 | memcmp(hdr->id, id, sizeof(hdr->id)) == 0; | ^~~~~~ This turns the errors into warnings so the build can complete. Signed-off-by: Joel Stanley Signed-off-by: Vasant Hegde --- Makefile.main | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Makefile.main') diff --git a/Makefile.main b/Makefile.main index 189b4ae..c8a63e8 100644 --- a/Makefile.main +++ b/Makefile.main @@ -163,6 +163,8 @@ CFLAGS += $(call try-cflag,$(CC),-Wjump-misses-init) \ $(call try-cflag,$(CC),-Wno-error=suggest-attribute=const) \ $(call try-cflag,$(CC),-Wno-error=suggest-attribute=noreturn) \ $(call try-cflag,$(CC),-Wstack-usage=1024) \ + $(call try-cflag,$(CC),-Wno-error=array-bounds) \ + $(call try-cflag,$(CC),-Wno-error=stringop-overread) \ $(call try-cflag,$(CC),-Wno-error=address-of-packed-member) CFLAGS += $(CWARNS) $(OPTS) $(DBG) -- cgit v1.1