From: Arnout Vandecappelle via buildroot <buildroot@buildroot.org>
To: Christian Stewart <christian@aperture.us>,
Fiona Klute <fiona.klute@gmx.de>
Cc: Buildroot Mailing List <buildroot@buildroot.org>,
yann.morin@orange.com, Thomas Perale <thomas.perale@mind.be>
Subject: Re: [Buildroot] [PATCH 1/1] package/containerd: fix build with toolchain without Gold linker
Date: Wed, 5 Feb 2025 09:03:19 +0100 [thread overview]
Message-ID: <527da78c-270f-4ec6-8a6e-1210456517a5@mind.be> (raw)
In-Reply-To: <CA+h8R2odWOyS=7=9LGGkBGHYENiLHtkj76_L2Zvq_PHOFYs9sA@mail.gmail.com>
On 04/02/2025 22:23, Christian Stewart wrote:
> Hi Fiona, Yann, all,
>
>
>
> On Tue, Feb 4, 2025, 6:32 AM Fiona Klute <fiona.klute@gmx.de
> <mailto:fiona.klute@gmx.de>> wrote:
>
> From: "Fiona Klute (WIWA)" <fiona.klute@gmx.de <mailto: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 <https://github.com/golang/go/
> issues/22040>
> [2] https://github.com/golang/go/issues/17847 <https://github.com/golang/go/
> issues/17847>
>
> Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de
> <mailto: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/ <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 <http://containerd.mk> | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/package/containerd/containerd.mk <http://containerd.mk> b/
> package/containerd/containerd.mk <http://containerd.mk>
> index ee07c22495..cb648f87a9 100644
> --- a/package/containerd/containerd.mk <http://containerd.mk>
> +++ b/package/containerd/containerd.mk <http://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 <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 <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
>
>
>
> This looks good to me. But shouldn't we apply this more generally to go-src and
> go-bin? It's true for all Go packages that we should pass these flags right? Why
> specifically containerd?
Yes I agree - this patch (and Yann's infrastructure patch that this patch
depends on) should be in pkg-golang instead of an individual package.
Regards,
Arnout
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2025-02-05 8:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=527da78c-270f-4ec6-8a6e-1210456517a5@mind.be \
--to=buildroot@buildroot.org \
--cc=arnout@mind.be \
--cc=christian@aperture.us \
--cc=fiona.klute@gmx.de \
--cc=thomas.perale@mind.be \
--cc=yann.morin@orange.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.