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

Sam Edwards cfsworks at gmail.com
Sat May 13 01:01:35 CEST 2023

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

More information about the U-Boot mailing list