1From 9901603e18524c4c52fd1dd47bda4ab4016628fc Mon Sep 17 00:00:00 2001 2From: Thomas Petazzoni <thomas.petazzoni@bootlin.com> 3Date: Thu, 10 Sep 2020 11:37:33 +0200 4Subject: [PATCH] Pass -fno-builtin to fix build with gcc 10 5 6gcc 10, if it recognizes some hand-written code that looks like 7memcpy, will generate a call to memcpy(). 8 9For example: 10 11 while (dst < &_end_data) { 12 *dst++ = *src++; 13 } 14 15gets recognized as such. However, in the context of bare-metal code, 16having a call to memcpy() in the C library doesn't work. So we fix 17that by disabling builtins. 18 19Fixes: 20 21/home/thomas/projets/buildroot/output/host/opt/ext-toolchain/bin/../arm-buildroot-uclinux-uclibcgnueabi/bin/ld.real: stm32f429i-disco.o: in function `reset': 22stm32f429i-disco.c:(.text.reset+0x1a): undefined reference to `memcpy' 23/home/thomas/projets/buildroot/output/host/opt/ext-toolchain/bin/../arm-buildroot-uclinux-uclibcgnueabi/bin/ld.real: stm32f429i-disco.c:(.text.reset+0x34): undefined reference to `memset' 24make[1]: *** [Makefile:26: stm32f429i-disco] Error 1 25 26Upstream: https://github.com/mcoquelin-stm32/afboot-stm32/pull/11 27Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> 28--- 29 Makefile | 1 + 30 1 file changed, 1 insertion(+) 31 32diff --git a/Makefile b/Makefile 33index f699176..1e8557d 100644 34--- a/Makefile 35+++ b/Makefile 36@@ -13,6 +13,7 @@ DTB_ADDR?=0x08004000 37 CFLAGS := -mthumb -mcpu=cortex-m4 38 CFLAGS += -ffunction-sections -fdata-sections 39 CFLAGS += -Os -std=gnu99 -Wall 40+CFLAGS += -fno-builtin 41 LINKERFLAGS := -nostartfiles --gc-sections 42 43 obj-y += gpio.o mpu.o qspi.o start_kernel.o 44-- 452.35.1 46 47