Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "J. Neuschäfer via buildroot" <buildroot@buildroot.org>
To: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: "J. Neuschäfer" <j.neuschaefer@gmx.net>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH v2 1/2] Config.in: ban textrels on musl toolchains
Date: Sun, 9 Jun 2024 14:54:55 +0200	[thread overview]
Message-ID: <ZmWmH6p7qlp3DHbT@probook> (raw)
In-Reply-To: <ZluLyQ7JHFYedvcv@landeda>

Hello Yann, sorry for the delay,

On Sat, Jun 01, 2024 at 10:59:53PM +0200, Yann E. MORIN wrote:
> On 2024-05-29 20:22 +0200, J. Neuschäfer via buildroot spake thusly:
> > musl-libc doesn't support TEXTRELs[1] and programs with TEXTRELs will
> > crash on start-up under musl.
> >
> > This patch forbids the use of TEXTRELs on musl, but adds an option to
> > either forbid them on other libcs as well, or allow them on musl.
>
> In your v1, Thomas suggested that textrels be simply always disabled for
> musl, because there is no way they can work. Allowing people to enable
> them on musl will only make things reak at runtime, rather than at build
> time.
>
> I'm on the same page as Thomas here: if textrels are unsupported on
> musl, then let's not allow them at all.

Alright, I wasn't fully certain about it, but I'll change the Kconfig
logic accordingly.

>
> > [1]: https://www.openwall.com/lists/musl/2020/09/25/4
> >
> > Signed-off-by: J. Neuschäfer <j.neuschaefer@gmx.net>
> > ---
> [--SNIP--]
> > diff --git a/Config.in b/Config.in
> > index b5a94325c4..92e89ed32d 100644
> > --- a/Config.in
> > +++ b/Config.in
> > @@ -910,6 +910,20 @@ endchoice
> >  comment "RELocation Read Only (RELRO) needs shared libraries"
> >  	depends on !BR2_SHARED_LIBS
> >
> > +config BR2_LINK_ZTEXT
> > +	bool "Disallow text section relocations (TEXTRELs)"
>
> We prefer positive logic:
>
>     config BR2_LINK_ZTEXT
>         bool "Allow text section relocations (TEXTRELs)"
>         default y  # Legacy
>         depends on !BR2_TOOLCHAIN_USES_MUSL
>         depends on !BR2_STATIC_LIBS

Good idea, this looks a bit easier to understand.

>
> and in the .mk:
>
>     ifeq ($(BR2_LINK_ZTEXT),)
>     TARGET_LDFLAGS += -z text
>     endif
>
> (Note the 'default y': textrels were previously always allowed, so we
> want to keep that behaviour by default)
>
> Regards,
> Yann E. MORIN.

Thanks for your review!
--jn
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2024-06-09 12:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-29 18:22 [Buildroot] [PATCH v2 0/2] Add option to ban textrels J. Neuschäfer via buildroot
2024-05-29 18:22 ` [Buildroot] [PATCH v2 1/2] Config.in: ban textrels on musl toolchains J. Neuschäfer via buildroot
2024-06-01 20:59   ` Yann E. MORIN
2024-06-09 12:54     ` J. Neuschäfer via buildroot [this message]
2024-05-29 18:22 ` [Buildroot] [PATCH v2 2/2] micropython: Add patch to avoid textrel on arm/thumb J. Neuschäfer via buildroot
2024-06-01 20:51   ` Yann E. MORIN
2024-06-08 17:01   ` Peter Korsgaard
2024-06-09  4:12     ` Baruch Siach via buildroot
2024-06-09  8:33       ` Peter Korsgaard

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=ZmWmH6p7qlp3DHbT@probook \
    --to=buildroot@buildroot.org \
    --cc=j.neuschaefer@gmx.net \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=yann.morin.1998@free.fr \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox