[PATCH 3/3] clang: Link with --no-pie instead of --apply-dynamic-relocs

Tom Rini trini at konsulko.com
Sun May 14 17:28:45 CEST 2023


On Fri, May 12, 2023 at 05:01:35PM -0600, Sam Edwards wrote:

> The goal of using --apply-dynamic-relocs seems to be to have all
> relocations applied "statically" to the output binary, so that
> the dynamic segment can be dropped safely. However, LLD still
> creates sections to support the dynamic section, and platform
> linker scripts may not know to discard these.
> 
> Since the build process does not appear to make use of the dynamic
> segment at all, it would be more sensible to suppress it entirely.
> 
> Signed-off-by: Sam Edwards <CFSworks at gmail.com>
> ---
>  Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index 20785860f7..d71127e412 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1024,7 +1024,7 @@ LDFLAGS_u-boot += $(LDFLAGS_FINAL)
>  LDFLAGS_u-boot += $(call ld-option, --no-dynamic-linker)
>  
>  # ld.lld support
> -LDFLAGS_u-boot += -z notext $(call ld-option,--apply-dynamic-relocs)
> +LDFLAGS_u-boot += -z notext $(call ld-option,--no-pie)
>  
>  LDFLAGS_u-boot += --build-id=none
>  

How extensively have you tested this change? We don't install ld.lld in
our container environment right now (but should..) and from some local
testing I forget if we need to pass further make logic in to have ld.lld
be used instead.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20230514/5cfe887a/attachment.sig>


More information about the U-Boot mailing list