2
1

0002-Makefile-unconditionally-disable-SSP.patch 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. From e389d5fbc296e496db15368b2b621e0f178f7f34 Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Sat, 8 May 2021 21:28:10 +0200
  4. Subject: [PATCH] Makefile: unconditionally disable SSP
  5. Though -nostdlib is passed in {C,+AS,DTSCPP}FLAGS, -fno-stack-protector
  6. must also be passed to avoid linking errors related to undefined
  7. references to '__stack_chk_guard' and '__stack_chk_fail' if toolchain
  8. enforces -fstack-protector.
  9. Fixes:
  10. - https://gitlab.com/kubu93/buildroot/-/jobs/1247043359
  11. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  12. [Upstream status: https://github.com/riscv/opensbi/pull/211]
  13. ---
  14. Makefile | 6 +++---
  15. 1 file changed, 3 insertions(+), 3 deletions(-)
  16. diff --git a/Makefile b/Makefile
  17. index eeffe6b..1419360 100644
  18. --- a/Makefile
  19. +++ b/Makefile
  20. @@ -203,7 +203,7 @@ GENFLAGS += $(libsbiutils-genflags-y)
  21. GENFLAGS += $(platform-genflags-y)
  22. GENFLAGS += $(firmware-genflags-y)
  23. -CFLAGS = -g -Wall -Werror -ffreestanding -nostdlib -fno-strict-aliasing -O2
  24. +CFLAGS = -g -Wall -Werror -ffreestanding -nostdlib -fno-stack-protector -fno-strict-aliasing -O2
  25. CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
  26. CFLAGS += -mno-save-restore -mstrict-align
  27. CFLAGS += -mabi=$(PLATFORM_RISCV_ABI) -march=$(PLATFORM_RISCV_ISA)
  28. @@ -217,7 +217,7 @@ CPPFLAGS += $(GENFLAGS)
  29. CPPFLAGS += $(platform-cppflags-y)
  30. CPPFLAGS += $(firmware-cppflags-y)
  31. -ASFLAGS = -g -Wall -nostdlib -D__ASSEMBLY__
  32. +ASFLAGS = -g -Wall -nostdlib -fno-stack-protector -D__ASSEMBLY__
  33. ASFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
  34. ASFLAGS += -mno-save-restore -mstrict-align
  35. ASFLAGS += -mabi=$(PLATFORM_RISCV_ABI) -march=$(PLATFORM_RISCV_ISA)
  36. @@ -236,7 +236,7 @@ MERGEFLAGS += -r
  37. MERGEFLAGS += -b elf$(PLATFORM_RISCV_XLEN)-littleriscv
  38. MERGEFLAGS += -m elf$(PLATFORM_RISCV_XLEN)lriscv
  39. -DTSCPPFLAGS = $(CPPFLAGS) -nostdinc -nostdlib -fno-builtin -D__DTS__ -x assembler-with-cpp
  40. +DTSCPPFLAGS = $(CPPFLAGS) -nostdinc -nostdlib -fno-stack-protector -fno-builtin -D__DTS__ -x assembler-with-cpp
  41. # Setup functions for compilation
  42. define dynamic_flags
  43. --
  44. 2.30.2