[PATCH] Use $(DEFAULT-LDFLAGS-$(@F)) in +link-static-before-libc

H.J. Lu hjl.tools@gmail.com
Wed Oct 4 01:13:00 GMT 2017


On 10/3/17, H.J. Lu <hjl.tools@gmail.com> wrote:
> Use $(LDFLAGS-$(@F)) with tst-tls1-static-non-pie may not be sufficient
> when static PIE is built by default.  Use $(DEFAULT-LDFLAGS-$(@F)) in
> +link-static-before-libc to make sure that tst-tls1-static-non-pie is
> always built as non-PIE static executable.
>
> Any comments?
>
> H.J.
> ---
> 	* Makeconfig (+link-static-before-libc): Use
> 	$(DEFAULT-LDFLAGS-$(@F)).
> 	* elf/Makefile (LDFLAGS-tst-tls1-static-non-pie): Renamed to ...
> 	(DEFAULT-LDFLAGS-tst-tls1-static-non-pie): This.
> ---
>  Makeconfig   | 1 +
>  elf/Makefile | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/Makeconfig b/Makeconfig
> index b51904b797..0ceff92a3d 100644
> --- a/Makeconfig
> +++ b/Makeconfig
> @@ -435,6 +435,7 @@ endif
>  # Command for statically linking programs with the C library.
>  ifndef +link-static
>  +link-static-before-libc = $(CC) -nostdlib -nostartfiles -static -o $@ \
> +	      $(DEFAULT-LDFLAGS-$(@F)) \
>  	      $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F))  \
>  	      $(addprefix $(csu-objpfx),$(static-start-installed-name)) \
>  	      $(+preinit) $(+prectorT) \
> diff --git a/elf/Makefile b/elf/Makefile
> index c6edebd4ee..06e2e4cd08 100644
> --- a/elf/Makefile
> +++ b/elf/Makefile
> @@ -152,7 +152,7 @@ tests-static-internal := tst-tls1-static tst-tls2-static
> \
>  	       tst-ptrguard1-static tst-stackguard1-static \
>  	       tst-tls1-static-non-pie
>
> -LDFLAGS-tst-tls1-static-non-pie = $(no-pie-ldflag)
> +DEFAULT-LDFLAGS-tst-tls1-static-non-pie = $(no-pie-ldflag)
>
>  tests := tst-tls9 tst-leaks1 \
>  	tst-array1 tst-array2 tst-array3 tst-array4 tst-array5 \

Here is the updated patch to add

+CRT-tst-tls1-static-non-pie := $(csu-objpfx)crt1.o

so that crt1.o is always used.


-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Use-DEFAULT-LDFLAGS-F-in-link-static-before-libc.patch
Type: text/x-patch
Size: 1908 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20171004/e69b91c2/attachment.bin>


More information about the Libc-alpha mailing list