diff mbox series

Makefile: unconditionally disable SSP

Message ID 20210515081638.2361496-1-fontaine.fabrice@gmail.com
State Accepted
Headers show
Series Makefile: unconditionally disable SSP | expand

Commit Message

Fabrice Fontaine May 15, 2021, 8:16 a.m. UTC
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

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bin Meng May 15, 2021, 11:27 a.m. UTC | #1
On Sat, May 15, 2021 at 4:30 PM Fabrice Fontaine
<fontaine.fabrice@gmail.com> wrote:
>
> 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
>
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
>  Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Xiang W May 15, 2021, 12:07 p.m. UTC | #2
在 2021-05-15六的 10:16 +0200,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.
> 
> Fixes:
>  - https://gitlab.com/kubu93/buildroot/-/jobs/1247043359
> 

Reviewed-by: Xiang W <wxjstz@126.com>

> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
>  Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index eeffe6b..6b64205 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)
> -- 
> 2.30.2
> 
>
Anup Patel May 19, 2021, 11:10 a.m. UTC | #3
> -----Original Message-----
> From: opensbi <opensbi-bounces@lists.infradead.org> On Behalf Of Xiang W
> Sent: 15 May 2021 17:37
> To: Fabrice Fontaine <fontaine.fabrice@gmail.com>;
> opensbi@lists.infradead.org
> Subject: Re: [PATCH] Makefile: unconditionally disable SSP
> 
> 在 2021-05-15六的 10:16 +0200,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.
> >
> > Fixes:
> >  - https://gitlab.com/kubu93/buildroot/-/jobs/1247043359
> >
> 
> Reviewed-by: Xiang W <wxjstz@126.com>

Applied this patch to the riscv/opensbi repo.

Regards,
Anup

> 
> > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> > ---
> >  Makefile | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/Makefile b/Makefile
> > index eeffe6b..6b64205 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)
> > --
> > 2.30.2
> >
> >
> 
> 
> --
> opensbi mailing list
> opensbi@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index eeffe6b..6b64205 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)