All of lore.kernel.org
 help / color / mirror / Atom feed
From: "J. Neuschäfer via buildroot" <buildroot@buildroot.org>
To: Rich Felker <dalias@libc.org>
Cc: buildroot@buildroot.org, musl@lists.openwall.com,
	"J. Neuschäfer" <j.neuschaefer@gmx.net>,
	lvm-devel@lists.linux.dev
Subject: Re: [Buildroot] [musl] [PATCH lvm2] acinclude.m4: Link when trying CCFLAGS
Date: Sat, 24 Aug 2024 00:15:37 +0200	[thread overview]
Message-ID: <ZskKCSueNCn3Ltg-@probook> (raw)
In-Reply-To: <20240811215226.GK10433@brightrain.aerifal.cx>

On Sun, Aug 11, 2024 at 05:52:29PM -0400, Rich Felker wrote:
> On Sun, Aug 11, 2024 at 11:04:38AM +0200, J. Neuschäfer wrote:
> > Through a build failure of LVM2 on musl-libc 1.2.5 in the Buildroot
> > autobuild service[1], I noticed that musl-libc's Scrt1 for microblaze
> > produces a relocation targeting the .text section, which subsequently
> > leads to a crash at run-time because musl-libc does not support
> > textrels[2]. Buildroot uses the "-z text" linker option to catch
> > textrels early, on musl-libc.
> >
> > The error can be reduced to the following test case:
> >
> >   $ cat hello.c
> >   #include <stdio.h>
> >   int main(void) { puts("Hello world!"); return 0; }
> >   $ host/bin/microblaze-buildroot-linux-musl-gcc hello.c -z text -pie -fPIC
> >   microblaze-buildroot-linux-musl/bin/ld: microblaze-buildroot-linux-musl/sysroot/lib/Scrt1.o:
> >     warning: relocation against `_start_c' in read-only section `.text'
> >   microblaze-buildroot-linux-musl/bin/ld: read-only segment has dynamic relocations
> >   collect2: error: ld returned 1 exit status
[...]
>
> No objection, but this is a bug in the tooling (ld) that we could also
> avoid on the musl side. So there are probably 3 places things should
> be changed here.
>
> Rich

I finally got around to testing your musl patch (http://0x0.st/XWB9.diff -
"use hidden visibility for C entry point function _start_c").
It solves the immediate problem for microblaze(el) as far as I can see.

I'm not familiar enough with linker intricacies to write a binutils/ld
bug report though.


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

WARNING: multiple messages have this Message-ID (diff)
From: "J. Neuschäfer" <j.neuschaefer@gmx.net>
To: Rich Felker <dalias@libc.org>
Cc: "J. Neuschäfer" <j.neuschaefer@gmx.net>,
	lvm-devel@lists.linux.dev, buildroot@buildroot.org,
	musl@lists.openwall.com
Subject: Re: [musl] [PATCH lvm2] acinclude.m4: Link when trying CCFLAGS
Date: Sat, 24 Aug 2024 00:15:37 +0200	[thread overview]
Message-ID: <ZskKCSueNCn3Ltg-@probook> (raw)
In-Reply-To: <20240811215226.GK10433@brightrain.aerifal.cx>

On Sun, Aug 11, 2024 at 05:52:29PM -0400, Rich Felker wrote:
> On Sun, Aug 11, 2024 at 11:04:38AM +0200, J. Neuschäfer wrote:
> > Through a build failure of LVM2 on musl-libc 1.2.5 in the Buildroot
> > autobuild service[1], I noticed that musl-libc's Scrt1 for microblaze
> > produces a relocation targeting the .text section, which subsequently
> > leads to a crash at run-time because musl-libc does not support
> > textrels[2]. Buildroot uses the "-z text" linker option to catch
> > textrels early, on musl-libc.
> >
> > The error can be reduced to the following test case:
> >
> >   $ cat hello.c
> >   #include <stdio.h>
> >   int main(void) { puts("Hello world!"); return 0; }
> >   $ host/bin/microblaze-buildroot-linux-musl-gcc hello.c -z text -pie -fPIC
> >   microblaze-buildroot-linux-musl/bin/ld: microblaze-buildroot-linux-musl/sysroot/lib/Scrt1.o:
> >     warning: relocation against `_start_c' in read-only section `.text'
> >   microblaze-buildroot-linux-musl/bin/ld: read-only segment has dynamic relocations
> >   collect2: error: ld returned 1 exit status
[...]
>
> No objection, but this is a bug in the tooling (ld) that we could also
> avoid on the musl side. So there are probably 3 places things should
> be changed here.
>
> Rich

I finally got around to testing your musl patch (http://0x0.st/XWB9.diff -
"use hidden visibility for C entry point function _start_c").
It solves the immediate problem for microblaze(el) as far as I can see.

I'm not familiar enough with linker intricacies to write a binutils/ld
bug report though.


-- jn

  reply	other threads:[~2024-08-23 22:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-11  9:04 [Buildroot] [PATCH lvm2] acinclude.m4: Link when trying CCFLAGS J. Neuschäfer via buildroot
2024-08-11  9:04 ` J. Neuschäfer
2024-08-11 21:52 ` [musl] " Rich Felker
2024-08-23 22:15   ` J. Neuschäfer via buildroot [this message]
2024-08-23 22:15     ` J. Neuschäfer

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=ZskKCSueNCn3Ltg-@probook \
    --to=buildroot@buildroot.org \
    --cc=dalias@libc.org \
    --cc=j.neuschaefer@gmx.net \
    --cc=lvm-devel@lists.linux.dev \
    --cc=musl@lists.openwall.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.