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