kumquat-buildroot/boot/afboot-stm32/0001-Pass-fno-builtin-to-fix-build-with-gcc-10.patch
Thomas Petazzoni cf5206ea98 boot/afboot-stm32: add patch fixing build issue with recent binutils
The afboot-stm32 build system was initially linking with gcc, but that
was changed upstream following a Buildroot contribution to use ld
instead.

However, the build system was still passing -nostartfiles, which is a
gcc option. By luck, this option was simply ignored by older versions
of ld (such as binutils 2.32), but newer versions of ld (2.36 and
newer, at least) no longer accept/ignore this option.

This commit adds a patch that drops the use of this option, since it
is useless for ld.

The first patch is slightly updated because the upstream pull request
has been updated to contain both build fixes.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2022-04-28 23:45:07 +02:00

47 lines
1.6 KiB
Diff

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