All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/containerd: fix build with toolchain without Gold linker
@ 2025-02-04 14:32 Fiona Klute via buildroot
  2025-02-04 14:47 ` yann.morin
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Fiona Klute via buildroot @ 2025-02-04 14:32 UTC (permalink / raw)
  To: buildroot
  Cc: yann.morin, Thomas Perale, Christian Stewart, Fiona Klute (WIWA)

From: "Fiona Klute (WIWA)" <fiona.klute@gmx.de>

Go forces use of the Gold linker on aarch64 due to a bug in BFD (the
default GNU linker) that is fixed in Binutils >= 2.41 [1]. All
toolchains provided by Buildroot have the fix, and none of them
provide Gold, so the forced setting breaks dynamic linking in
Buildroot. Set EXTLDFLAGS to use BFD instead.

Additionally disable PIE on musl to fix "read-only segment has dynamic
relocations" errors during linking [2].

[1] https://github.com/golang/go/issues/22040
[2] https://github.com/golang/go/issues/17847

Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de>
---
This patch requires Yann E. Morin's patch that introduces
PACKAGE_EXTLDFLAGS:
https://patchwork.ozlabs.org/project/buildroot/patch/876f3a7bb6a2375193fc8f06ab856d2449f83727.1699547993.git.yann.morin@orange.com/

Based on the linked issue the --no-pie linker flag should be needed
only for musl, but I'd be grateful if anyone could test with glibc.

 package/containerd/containerd.mk | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/package/containerd/containerd.mk b/package/containerd/containerd.mk
index ee07c22495..cb648f87a9 100644
--- a/package/containerd/containerd.mk
+++ b/package/containerd/containerd.mk
@@ -49,6 +49,20 @@ ifneq ($(BR2_PACKAGE_CONTAINERD_CRI),y)
 CONTAINERD_TAGS += no_cri
 endif
 
+ifeq ($(BR2_aarch64),y)
+# Go forces use of the Gold linker on aarch64 due to a bug in BFD that
+# is fixed in Binutils >= 2.41 (so all versions provided by
+# Buildroot). Forcing Gold will break with toolchains that don't
+# provide it, so override the flag and use BFD.
+# See: https://github.com/golang/go/issues/22040
+CONTAINERD_EXTLDFLAGS += -fuse-ld=bfd
+ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y)
+# Go exe build with PIE doesn't work with musl.
+# See: https://github.com/golang/go/issues/17847
+CONTAINERD_EXTLDFLAGS += -Wl,--no-pie
+endif
+endif
+
 define CONTAINERD_INSTALL_INIT_SYSTEMD
 	$(INSTALL) -D -m 0644 $(@D)/containerd.service \
 		$(TARGET_DIR)/usr/lib/systemd/system/containerd.service
-- 
2.47.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2025-02-05 11:40 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-04 14:32 [Buildroot] [PATCH 1/1] package/containerd: fix build with toolchain without Gold linker Fiona Klute via buildroot
2025-02-04 14:47 ` yann.morin
2025-02-04 18:36   ` Fiona Klute via buildroot
2025-02-04 20:29     ` Fiona Klute via buildroot
2025-02-04 21:23 ` Christian Stewart via buildroot
2025-02-05  8:03   ` Arnout Vandecappelle via buildroot
2025-02-05  8:29     ` yann.morin
2025-02-05  9:20       ` Christian Stewart via buildroot
2025-02-05  9:41         ` yann.morin
2025-02-05  9:42         ` Arnout Vandecappelle via buildroot
2025-02-05 10:24           ` Fiona Klute via buildroot
2025-02-05 10:33 ` Arnout Vandecappelle via buildroot
2025-02-05 11:40   ` Fiona Klute via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.