0001-Pass-fno-builtin-to-fix-build-with-gcc-10.patch 1.6 KB

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