mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] sandbox: Fix fixing linker warnings with newer ld
@ 2023-02-21 15:24 Sascha Hauer
  2023-02-21 15:27 ` Ahmad Fatoum
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2023-02-21 15:24 UTC (permalink / raw)
  To: Barebox List; +Cc: Ahmad Fatoum

There must be a comma between the words passed in the -Wl option,
otherwise gcc responds with:

gcc: error: noexecstack: No such file or directory

Also cc-option only compiles but doesn't link, so can't detect if the
linker accepts flags or not. Use ld-option instead.

Fixes: 4e8713dd6e ("sandbox: fix linker warnings with newer ld")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/sandbox/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile
index 0f59e79e13..9d5a5d8c6a 100644
--- a/arch/sandbox/Makefile
+++ b/arch/sandbox/Makefile
@@ -69,7 +69,7 @@ BAREBOX_LDFLAGS += \
 	-Wl,-T,$(BAREBOX_LDS) \
 	-Wl,--whole-archive $(BAREBOX_OBJS) -Wl,--no-whole-archive \
 	-lrt -pthread $(SDL_LIBS) $(FTDI1_LIBS) \
-	-Wl,-z noexecstack $(call cc-option,-Wl$(comma)--no-warn-rwx-segments) \
+	-Wl,-z,noexecstack $(call ld-option,--no-warn-rwx-segments) \
 	$(SANITIZER_LIBS)
 
 cmd_barebox__ = $(CC) -o $@ $(BAREBOX_LDFLAGS)
-- 
2.30.2




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] sandbox: Fix fixing linker warnings with newer ld
  2023-02-21 15:24 [PATCH] sandbox: Fix fixing linker warnings with newer ld Sascha Hauer
@ 2023-02-21 15:27 ` Ahmad Fatoum
  2023-02-21 15:46   ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: Ahmad Fatoum @ 2023-02-21 15:27 UTC (permalink / raw)
  To: Sascha Hauer, Barebox List

Hello Sascha,

On 21.02.23 16:24, Sascha Hauer wrote:
> There must be a comma between the words passed in the -Wl option,
> otherwise gcc responds with:
> 
> gcc: error: noexecstack: No such file or directory
> 
> Also cc-option only compiles but doesn't link, so can't detect if the
> linker accepts flags or not. Use ld-option instead.
> 
> Fixes: 4e8713dd6e ("sandbox: fix linker warnings with newer ld")
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  arch/sandbox/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile
> index 0f59e79e13..9d5a5d8c6a 100644
> --- a/arch/sandbox/Makefile
> +++ b/arch/sandbox/Makefile
> @@ -69,7 +69,7 @@ BAREBOX_LDFLAGS += \
>  	-Wl,-T,$(BAREBOX_LDS) \
>  	-Wl,--whole-archive $(BAREBOX_OBJS) -Wl,--no-whole-archive \
>  	-lrt -pthread $(SDL_LIBS) $(FTDI1_LIBS) \
> -	-Wl,-z noexecstack $(call cc-option,-Wl$(comma)--no-warn-rwx-segments) \
> +	-Wl,-z,noexecstack $(call ld-option,--no-warn-rwx-segments) \

At least gcc version 11.3.0 wouldn't like this:

$ gcc --no-warn-rwx-segments
gcc: error: unrecognized command-line option ‘--no-warn-rwx-segments’

That's why I usued -Wl, in the first place

>  	$(SANITIZER_LIBS)
>  
>  cmd_barebox__ = $(CC) -o $@ $(BAREBOX_LDFLAGS)

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] sandbox: Fix fixing linker warnings with newer ld
  2023-02-21 15:27 ` Ahmad Fatoum
@ 2023-02-21 15:46   ` Sascha Hauer
  0 siblings, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2023-02-21 15:46 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: Barebox List

On Tue, Feb 21, 2023 at 04:27:37PM +0100, Ahmad Fatoum wrote:
> Hello Sascha,
> 
> On 21.02.23 16:24, Sascha Hauer wrote:
> > There must be a comma between the words passed in the -Wl option,
> > otherwise gcc responds with:
> > 
> > gcc: error: noexecstack: No such file or directory
> > 
> > Also cc-option only compiles but doesn't link, so can't detect if the
> > linker accepts flags or not. Use ld-option instead.
> > 
> > Fixes: 4e8713dd6e ("sandbox: fix linker warnings with newer ld")
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > ---
> >  arch/sandbox/Makefile | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile
> > index 0f59e79e13..9d5a5d8c6a 100644
> > --- a/arch/sandbox/Makefile
> > +++ b/arch/sandbox/Makefile
> > @@ -69,7 +69,7 @@ BAREBOX_LDFLAGS += \
> >  	-Wl,-T,$(BAREBOX_LDS) \
> >  	-Wl,--whole-archive $(BAREBOX_OBJS) -Wl,--no-whole-archive \
> >  	-lrt -pthread $(SDL_LIBS) $(FTDI1_LIBS) \
> > -	-Wl,-z noexecstack $(call cc-option,-Wl$(comma)--no-warn-rwx-segments) \
> > +	-Wl,-z,noexecstack $(call ld-option,--no-warn-rwx-segments) \
> 
> At least gcc version 11.3.0 wouldn't like this:
> 
> $ gcc --no-warn-rwx-segments
> gcc: error: unrecognized command-line option ‘--no-warn-rwx-segments’

Makes sense, as we are calling $(CC) for linking.

For now I'll revert the original patch.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-21 15:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-21 15:24 [PATCH] sandbox: Fix fixing linker warnings with newer ld Sascha Hauer
2023-02-21 15:27 ` Ahmad Fatoum
2023-02-21 15:46   ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox