Message ID | 20241023-microblaze-v1-1-7ad68e2f271c@gmx.net |
---|---|
State | Accepted |
Headers | show |
Series | package/musl: Fix -ztext build failures on microblaze | expand |
On 23/10/2024 23:43, J. Neuschäfer via buildroot wrote: > The particular combination of LVM2 (which enables -PIE), musl-libc with > dynamic linking (and thus -ztext, banning TEXTRELs), and microblaze > leads to an error because a TEXTREL is produced in musl-libc's Scrt1.o. > > The upstream patch added in this commit fixes (or works around) the > problem. > > Fixes: http://autobuild.buildroot.net/results/5bb283eff4b4a2b17d1028bbe0b3e1bea8fbeba8/ > Signed-off-by: J. Neuschäfer <j.neuschaefer@gmx.net> Applied to master, thanks. Regards, Arnout > --- > ...visibility-for-C-entry-point-function-_st.patch | 42 ++++++++++++++++++++++ > 1 file changed, 42 insertions(+) > > diff --git a/package/musl/0003-use-hidden-visibility-for-C-entry-point-function-_st.patch b/package/musl/0003-use-hidden-visibility-for-C-entry-point-function-_st.patch > new file mode 100644 > index 0000000000000000000000000000000000000000..c3f4f1def0500200e7f616c56cc4183d6b1440f8 > --- /dev/null > +++ b/package/musl/0003-use-hidden-visibility-for-C-entry-point-function-_st.patch > @@ -0,0 +1,42 @@ > +From 9c78557af0a5e521cdb46a4ca7630f2987d2523e Mon Sep 17 00:00:00 2001 > +From: Rich Felker <dalias@aerifal.cx> > +Date: Sat, 10 Aug 2024 19:49:24 -0400 > +Subject: [PATCH] use hidden visibility for C entry point function _start_c > + > +the file-level crt_arch.h asm fragments generally make direct > +(non-PLT) calls from _start to _start_c, which is only valid when > +there is a local, non-interposable definition for _start_c. generally, > +the linker is expected to know that local definitions in a main > +executable (as opposed to shared library) output are non-interposable, > +making this work, but historically there have been linker bugs in this > +area, and microblaze is reportedly still broken, flagging the > +relocation for the call as a textrel. > + > +the equivalent _dlstart_c, called from the same crt_arch.h asm > +fragments, has always used hidden visibility without problem, and > +semantically it should be hidden, so make it hidden. this ensures the > +direct call is always valid regardless of whether the linker properly > +special-cases main executable output. > + > +Upstream: https://git.musl-libc.org/cgit/musl/commit/?id=9c78557af0a5e521cdb46a4ca7630f2987d2523e > +Signed-off-by: J. Neuschäfer <j.neuschaefer@gmx.net> > +--- > + crt/crt1.c | 2 +- > + 1 file changed, 1 insertion(+), 1 deletion(-) > + > +diff --git a/crt/crt1.c b/crt/crt1.c > +index 8fe8ab5d..10601215 100644 > +--- a/crt/crt1.c > ++++ b/crt/crt1.c > +@@ -11,7 +11,7 @@ weak void _fini(); > + int __libc_start_main(int (*)(), int, char **, > + void (*)(), void(*)(), void(*)()); > + > +-void _start_c(long *p) > ++hidden void _start_c(long *p) > + { > + int argc = p[0]; > + char **argv = (void *)(p+1); > +-- > +2.45.2 > + > > --- > base-commit: 4a9a4c3cd5f416b44b8ab6c3c7cdfc3cc991a5de > change-id: 20241023-microblaze-028f015b2ed4 > > Best regards, > -- > J. Neuschäfer <j.neuschaefer@gmx.net> > > _______________________________________________ > buildroot mailing list > buildroot@buildroot.org > https://lists.buildroot.org/mailman/listinfo/buildroot
>>>>> "Arnout" == Arnout Vandecappelle via buildroot <buildroot@buildroot.org> writes: > On 23/10/2024 23:43, J. Neuschäfer via buildroot wrote: >> The particular combination of LVM2 (which enables -PIE), musl-libc with >> dynamic linking (and thus -ztext, banning TEXTRELs), and microblaze >> leads to an error because a TEXTREL is produced in musl-libc's Scrt1.o. >> The upstream patch added in this commit fixes (or works around) the >> problem. >> Fixes: >> http://autobuild.buildroot.net/results/5bb283eff4b4a2b17d1028bbe0b3e1bea8fbeba8/ >> Signed-off-by: J. Neuschäfer <j.neuschaefer@gmx.net> > Applied to master, thanks. Committed to 2024.02.x and 2024.08.x, thanks.
diff --git a/package/musl/0003-use-hidden-visibility-for-C-entry-point-function-_st.patch b/package/musl/0003-use-hidden-visibility-for-C-entry-point-function-_st.patch new file mode 100644 index 0000000000000000000000000000000000000000..c3f4f1def0500200e7f616c56cc4183d6b1440f8 --- /dev/null +++ b/package/musl/0003-use-hidden-visibility-for-C-entry-point-function-_st.patch @@ -0,0 +1,42 @@ +From 9c78557af0a5e521cdb46a4ca7630f2987d2523e Mon Sep 17 00:00:00 2001 +From: Rich Felker <dalias@aerifal.cx> +Date: Sat, 10 Aug 2024 19:49:24 -0400 +Subject: [PATCH] use hidden visibility for C entry point function _start_c + +the file-level crt_arch.h asm fragments generally make direct +(non-PLT) calls from _start to _start_c, which is only valid when +there is a local, non-interposable definition for _start_c. generally, +the linker is expected to know that local definitions in a main +executable (as opposed to shared library) output are non-interposable, +making this work, but historically there have been linker bugs in this +area, and microblaze is reportedly still broken, flagging the +relocation for the call as a textrel. + +the equivalent _dlstart_c, called from the same crt_arch.h asm +fragments, has always used hidden visibility without problem, and +semantically it should be hidden, so make it hidden. this ensures the +direct call is always valid regardless of whether the linker properly +special-cases main executable output. + +Upstream: https://git.musl-libc.org/cgit/musl/commit/?id=9c78557af0a5e521cdb46a4ca7630f2987d2523e +Signed-off-by: J. Neuschäfer <j.neuschaefer@gmx.net> +--- + crt/crt1.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/crt/crt1.c b/crt/crt1.c +index 8fe8ab5d..10601215 100644 +--- a/crt/crt1.c ++++ b/crt/crt1.c +@@ -11,7 +11,7 @@ weak void _fini(); + int __libc_start_main(int (*)(), int, char **, + void (*)(), void(*)(), void(*)()); + +-void _start_c(long *p) ++hidden void _start_c(long *p) + { + int argc = p[0]; + char **argv = (void *)(p+1); +-- +2.45.2 +
The particular combination of LVM2 (which enables -PIE), musl-libc with dynamic linking (and thus -ztext, banning TEXTRELs), and microblaze leads to an error because a TEXTREL is produced in musl-libc's Scrt1.o. The upstream patch added in this commit fixes (or works around) the problem. Fixes: http://autobuild.buildroot.net/results/5bb283eff4b4a2b17d1028bbe0b3e1bea8fbeba8/ Signed-off-by: J. Neuschäfer <j.neuschaefer@gmx.net> --- ...visibility-for-C-entry-point-function-_st.patch | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) --- base-commit: 4a9a4c3cd5f416b44b8ab6c3c7cdfc3cc991a5de change-id: 20241023-microblaze-028f015b2ed4 Best regards, -- J. Neuschäfer <j.neuschaefer@gmx.net>