Skip to contentSkip to conversation

Makefile: unconditionally disable SSP

PATCH New Fabrice Fontaine 4 participants 4 messages May 15, 2021 – May 19, 2021 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: unconditionally disable SSP

Though -nostdlib is passed in CFLAGS, -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

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index eeffe6b..6b64205 100644
@@ -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)
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/1 Makefile: unconditionally disable SSP

Quoted 6 lines · Fabrice Fontaine

Though -nostdlib is passed in CFLAGS, -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.

Quoted 8 lines

Fixes:
- https://gitlab.com/kubu93/buildroot/-/jobs/1247043359

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#2 lore raw

PATCH 1/1 Makefile: unconditionally disable SSP

In reply to Fabrice Fontaine

? 2021-05-15?? 10:16 +0200?Fabrice Fontaine???

Quoted 9 lines

Though -nostdlib is passed in CFLAGS, -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

Quoted 26 lines
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -3
index eeffe6b..6b64205 100644
@@ -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)

Signature · 1 line
2.30.2
Applied
#3 lore raw

PATCH 1/1 Makefile: unconditionally disable SSP

Quoted 15 lines

-----Original Message-----
From: opensbi <[email protected]> On Behalf Of Xiang W
Sent: 15 May 2021 17:37
To: Fabrice Fontaine <[email protected]>;
opensbi at lists.infradead.org
Subject: Re: [PATCH] Makefile: unconditionally disable SSP

? 2021-05-15?? 10:16 +0200?Fabrice Fontaine???

Quoted 5 lines

Though -nostdlib is passed in CFLAGS, -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.

Quoted 5 lines
Quoted 3 lines

Fixes:
- https://gitlab.com/kubu93/buildroot/-/jobs/1247043359

Applied this patch to the riscv/opensbi repo.

Regards,
Anup

Quoted 33 lines
Quoted 19 lines
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -3
index eeffe6b..6b64205 100644
@@ -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-
Quoted 8 lines

optimize-sibling-calls
CFLAGS += -mno-save-restore -mstrict-align
CFLAGS += -mabi=$(PLATFORM_RISCV_ABI)
-march=$(PLATFORM_RISCV_ISA)
--
2.30.2

--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi