diff mbox series

Pass -nostdlib -nostartfiles together with -r [BZ #31753]

Message ID 20240518030038.622775-1-hjl.tools@gmail.com
State New
Headers show
Series Pass -nostdlib -nostartfiles together with -r [BZ #31753] | expand

Commit Message

H.J. Lu May 18, 2024, 3 a.m. UTC
Since -r in GCC 6/7/8 doesn't imply -nostdlib -nostartfiles, update the
link-static-libc.out rule to also pass -nostdlib -nostartfiles.  This
fixes BZ #31753.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Florian Weimer May 19, 2024, 7:24 p.m. UTC | #1
* H. J. Lu:

> Since -r in GCC 6/7/8 doesn't imply -nostdlib -nostartfiles, update the
> link-static-libc.out rule to also pass -nostdlib -nostartfiles.  This
> fixes BZ #31753.
>
> Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
> ---
>  Makefile | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index adf4749124..c84f266ce7 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -581,7 +581,8 @@ $(objpfx)lint-makefiles.out: scripts/lint-makefiles.sh
>  # definitions of any symbols.
>  tests-special += $(objpfx)link-static-libc.out
>  $(objpfx)link-static-libc.out:
> -	$(LINK.o) $(whole-archive) -r $(objpfx)libc.a -o /dev/null > $@ 2>&1; \
> +	$(LINK.o) $(whole-archive) -nostdlib -nostartfiles -r \
> +	  $(objpfx)libc.a -o /dev/null > $@ 2>&1; \
>  	$(evaluate-test)
>  
>  # Print test summary for tests in $1 .sum file;

Ahh, I was confused, this is actually a new test.  The tst- prefix would
have helped.

Change looks good.

Reviewed-by: Florian Weimer <fweimer@redhat.com>

Thanks,
Florian
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index adf4749124..c84f266ce7 100644
--- a/Makefile
+++ b/Makefile
@@ -581,7 +581,8 @@  $(objpfx)lint-makefiles.out: scripts/lint-makefiles.sh
 # definitions of any symbols.
 tests-special += $(objpfx)link-static-libc.out
 $(objpfx)link-static-libc.out:
-	$(LINK.o) $(whole-archive) -r $(objpfx)libc.a -o /dev/null > $@ 2>&1; \
+	$(LINK.o) $(whole-archive) -nostdlib -nostartfiles -r \
+	  $(objpfx)libc.a -o /dev/null > $@ 2>&1; \
 	$(evaluate-test)
 
 # Print test summary for tests in $1 .sum file;