All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnout Vandecappelle via buildroot <buildroot@buildroot.org>
To: Fiona Klute <fiona.klute@gmx.de>, buildroot@buildroot.org
Cc: Christian Stewart <christian@aperture.us>,
	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 11:33:11 +0100	[thread overview]
Message-ID: <f2073884-da55-4f02-8bb4-a39702bc4794@mind.be> (raw)
In-Reply-To: <20250204143227.1233163-1-fiona.klute@gmx.de>

  Hi Fiona,

On 04/02/2025 15:32, Fiona Klute wrote:
> 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/

  After all this discussion, could you respin this as:

- a series where Yann's patch is 1/2. It's quite confusing for us maintainers to 
have a patch that depends on another patch, unless when it's part of a series. 
You can just apply that patch on your branch, add your own signed-off-by, and 
include it in your own series;
- add the use-ld=bfd as part of the golang infrastructure;
- I'm not sure about the PIE part yet, but you can try building any other CGO 
package with a musl toolchain and if it fails as well it needs to be in the infra.


  Regards,
  Arnout


> 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

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

  parent reply	other threads:[~2025-02-05 10:33 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
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 [this message]
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=f2073884-da55-4f02-8bb4-a39702bc4794@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.