DTPMOD mod fix for musl's rcrt0
PATCH 1/2 DTPMOD mod fix for musl's rcrt0
See https://github.com/rust-lang/rust/issues/46566
--- package/musl/0002-fix-rcrt1.o.patch | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 package/musl/0002-fix-rcrt1.o.patch
package/musl/0002-fix-rcrt1.o.patch new file +26 -0
@@ -0,0 +1,26 @@ +diff --git a/ldso/dlstart.c b/ldso/dlstart.c +index 4dbe178..0dd1d5a 100644 +--- a/ldso/dlstart.c ++++ b/ldso/dlstart.c +@@ -128,16 +128,18 @@ void _dlstart_c(size_t *sp, size_t *dynv) + rel = (void *)(base+dyn[DT_REL]); + rel_size = dyn[DT_RELSZ]; + for (; rel_size; rel+=2, rel_size-=2*sizeof(size_t)) { +- if (!IS_RELATIVE(rel[1], 0)) continue; + size_t *rel_addr = (void *)(base + rel[0]); ++ if (rel[1] == REL_DTPMOD) *rel_addr = 1; ++ if (!IS_RELATIVE(rel[1], 0)) continue; + *rel_addr += base; + } + + rel = (void *)(base+dyn[DT_RELA]); + rel_size = dyn[DT_RELASZ]; + for (; rel_size; rel+=3, rel_size-=3*sizeof(size_t)) { +- if (!IS_RELATIVE(rel[1], 0)) continue; + size_t *rel_addr = (void *)(base + rel[0]); ++ if (rel[1] == REL_DTPMOD) *rel_addr = 1; ++ if (!IS_RELATIVE(rel[1], 0)) continue; + *rel_addr = base + rel[2]; + } + #endif +
Signature · 1 line
2.15.1
PATCH 2/2 enable static linking for libfuse
--- package/libfuse/Config.in | 4 ---- package/libfuse/libfuse.mk | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-)
package/libfuse/Config.in +0 -4
@@ -1,7 +1,6 @@ config BR2_PACKAGE_LIBFUSE bool "libfuse" # Really doesn't like static, see fuse/lib/fuse.c - depends on !BR2_STATIC_LIBS depends on BR2_TOOLCHAIN_HAS_THREADS depends on BR2_USE_MMU # fork() help
@@ -9,6 +8,3 @@ config BR2_PACKAGE_LIBFUSE https://github.com/libfuse/libfuse -comment "libfuse needs a toolchain w/ threads, dynamic library" - depends on BR2_USE_MMU - depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
package/libfuse/libfuse.mk +2 -1
@@ -12,13 +12,14 @@ LIBFUSE_LICENSE_FILES = COPYING COPYING.LIB LIBFUSE_INSTALL_STAGING = YES LIBFUSE_DEPENDENCIES = $(if $(BR2_PACKAGE_LIBICONV),libiconv) LIBFUSE_CONF_OPTS = \ + --enable-static \ --disable-example \ --enable-lib \ --enable-util define LIBFUSE_INSTALL_TARGET_CMDS cp -dpf $(STAGING_DIR)/usr/bin/fusermount $(TARGET_DIR)/usr/bin/ - cp -dpf $(STAGING_DIR)/usr/lib/libfuse.so* $(TARGET_DIR)/usr/lib/ + cp -dpf $(STAGING_DIR)/usr/lib/libfuse.a* $(TARGET_DIR)/usr/lib/ endef $(eval $(autotools-package))
Signature · 1 line
2.15.1
PATCH 2/2 enable static linking for libfuse
Hello,
Thanks for your contribution. However...
Quoted 11 lines · Arvid E. Picciani
Signed-off-by Arvid E. Picciani <[email protected]>--- package/libfuse/Config.in | 4 ---- package/libfuse/libfuse.mk | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-)package/libfuse/Config.in +0
-0
package/libfuse/Config.in line 3
Quoted 3 lines
package/libfuse/Config.in +0
-0@@ -1,7 +1,6 @@ config BR2_PACKAGE_LIBFUSE bool "libfuse" # Really doesn't like static, see fuse/lib/fuse.c
...did you see this comment?
fuse.c uses dlopen(), this requires shared library support.
Apply your patch, and build the following configuration:
BR2_arm=y
BR2_STATIC_LIBS=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-arm-full-static-2017.11-rc1.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_6=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_10=y
BR2_TOOLCHAIN_EXTERNAL_LOCALE=y
# BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG is not set
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_LIBFUSE=y
# BR2_TARGET_ROOTFS_TAR is not set
You'll get the following build failure:
fuse.c:33:19: fatal error: dlfcn.h: No such file or directory
#include <dlfcn.h>
^compilation terminated.
Also, passing --enable-static is not necessary, this is already done by the autotools-package infrastructure when BR2_STATIC_LIBS=y.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 2/2 enable static linking for libfuse
thanks for checking.
yes i did see the comment that's why i didnt submit a proper patch but more an RFC.
It builds fine for me. maybe it doesn't try to use the dlopen stuff with musl?
Quoted 53 lines · Thomas Petazzoni
Hello,
Thanks for your contribution. However...
Quoted 11 lines · Arvid E. Picciani
Signed-off-by Arvid E. Picciani <[email protected]>--- package/libfuse/Config.in | 4 ---- package/libfuse/libfuse.mk | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-)package/libfuse/Config.in +0
-0package/libfuse/Config.in line 3
Quoted 3 lines
package/libfuse/Config.in +0
-0@@ -1,7 +1,6 @@ config BR2_PACKAGE_LIBFUSE bool "libfuse" # Really doesn't like static, see fuse/lib/fuse.c...did you see this comment?
fuse.cusesdlopen(), this requires shared library support.Apply your patch, and build the following configuration:
BR2_arm=y
BR2_STATIC_LIBS=y
BR2_TOOLCHAIN_EXTERNAL=y BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/ toolchains/tarballs/br-arm-full-static-2017.11-rc1.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_6=y BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_10=y BR2_TOOLCHAIN_EXTERNAL_LOCALE=y
#BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUGis not set BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
#BR2_PACKAGE_BUSYBOXis not set BR2_PACKAGE_LIBFUSE=y
#BR2_TARGET_ROOTFS_TARis not setYou'll get the following build failure:
fuse.c:33:19: fatal error:
dlfcn.h: No such file or directory#include <dlfcn.h> ^compilation terminated.
Also, passing --enable-static is not necessary, this is already done by the autotools-package infrastructure when BR2_STATIC_LIBS=y.
Quoted 8 lines
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20171214/0ba423a7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: config
Type: application/octet-stream
Size: 77278 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20171214/0ba423a7/attachment.obj>
PATCH 2/2 enable static linking for libfuse
Hello,
Quoted 4 lines · Arvid Picciani
yes i did see the comment that's why i didnt submit a proper patch but more an RFC.
It builds fine for me. maybe it doesn't try to use the dlopen stuff with musl?
I guess musl always has dlopen(), even in a purely statically linked scenario, while uClibc does not have it.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 2/2 enable static linking for libfuse
Hi Thomas
Thomas Petazzoni kirjoitti 14.12.2017 klo 17:52:
Quoted 4 lines
Hello,
On Thu, 14 Dec 2017 16:27:36 +0100, Arvid Picciani wrote:
Quoted 8 lines
Quoted 4 lines
yes i did see the comment that's why i didnt submit a proper patch but more an RFC.
It builds fine for me. maybe it doesn't try to use the dlopen stuff with musl?I guess musl always has
dlopen(), even in a purely statically linked scenario, while uClibc does not have it.Thomas
But doesn't static glibc also use dlopen() ?
-S-
PATCH 2/2 enable static linking for libfuse
Ah, found this from 2012:
http://openwall.com/lists/musl/2012/12/08/4
So for statically linked musl (and uclibc) dlopen is no no
-S-
Stefan Fr?berg kirjoitti 15.12.2017 klo 15:12:
Quoted 23 lines
Hi Thomas
Thomas Petazzoni kirjoitti 14.12.2017 klo 17:52:
Quoted 4 lines
Hello,
On Thu, 14 Dec 2017 16:27:36 +0100, Arvid Picciani wrote:
Quoted 8 lines
Quoted 4 lines
yes i did see the comment that's why i didnt submit a proper patch but more an RFC.
It builds fine for me. maybe it doesn't try to use the dlopen stuff with musl?I guess musl always has
dlopen(), even in a purely statically linked scenario, while uClibc does not have it.Thomas
But doesn't static glibc also use
dlopen()?-S-
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
PATCH 2/2 enable static linking for libfuse
In reply to Stefan FröbergHello,
Quoted 6 lines · Stefan Fr?berg
Quoted 4 lines
I guess musl always has
dlopen(), even in a purely statically linked scenario, while uClibc does not have it.Thomas
But doesn't static glibc also use
dlopen()?
We don't support glibc with BR2_STATIC_LIBS=y.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 2/2 enable static linking for libfuse
In reply to Arvid PiccianiHi Arvid
Arvid Picciani kirjoitti 14.12.2017 klo 17:27:
Quoted 6 lines
thanks for checking.
yes i did see the comment that's why i didnt submit a proper patch but more an RFC.
It builds fine for me. maybe it doesn't try to use the dlopen stuff with musl?
Just out of interest:? do you also have the following static musl libraries with size 8 bytes and
content just "!<arch>" and nothing more :
libcrypt,a libdl.a libm.a libpthread.a libresolv.a librt.a libutil.a libxnet.a
Musl seems to stuff all their stuff into libc.a when using static linking?
I am asking this because I have dlopen problem with static linking Python on musl.
(or actually, I can build Python completely statically against musl just fine if I disable the dlopen part but that will
also disable pip and setuptools support)
-S-
Quoted 71 lines
On Thu, Dec 14, 2017 at 4:21 PM, Thomas Petazzoni <[email protected] <mailto:[email protected]>> wrote:
Hello, Thanks for your contribution. However... On Thu, 14 Dec 2017 11:57:06 +0100, Arvid E. Picciani wrote: > Signed-off-by: Arvid E. Picciani <[email protected] <mailto:[email protected]>> > --- >? package/libfuse/Config.in? | 4 ---- >? package/libfuse/libfuse.mk <http://libfuse.mk> | 3 ++- >? 2 files changed, 2 insertions(+), 5 deletions(-) > > diff --git a/package/libfuse/Config.in b/package/libfuse/Config.in > index 2b0e31a991..62b18c2444 100644 > --- a/package/libfuse/Config.in > +++ b/package/libfuse/Config.in > @@ -1,7 +1,6 @@ >? config BR2_PACKAGE_LIBFUSE >? ? ? ?bool "libfuse" >? ? ? ?# Really doesn't like static, see fuse/lib/fuse.c ...did you see this comment? fuse.c uses dlopen(), this requires shared library support. Apply your patch, and build the following configuration: BR2_arm=y BR2_STATIC_LIBS=y BR2_TOOLCHAIN_EXTERNAL=y BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-arm-full-static-2017.11-rc1.tar.bz2 <http://autobuild.buildroot.org/toolchains/tarballs/br-arm-full-static-2017.11-rc1.tar.bz2>" BR2_TOOLCHAIN_EXTERNAL_GCC_6=y BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_10=y BR2_TOOLCHAIN_EXTERNAL_LOCALE=y # BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG is not set BR2_TOOLCHAIN_EXTERNAL_CXX=y BR2_INIT_NONE=y BR2_SYSTEM_BIN_SH_NONE=y # BR2_PACKAGE_BUSYBOX is not set BR2_PACKAGE_LIBFUSE=y # BR2_TARGET_ROOTFS_TAR is not set You'll get the following build failure: fuse.c:33:19: fatal error: dlfcn.h: No such file or directory ?#include <dlfcn.h> ? ? ? ? ? ? ? ? ? ?^ compilation terminated. Also, passing --enable-static is not necessary, this is already done by the autotools-package infrastructure when BR2_STATIC_LIBS=y. Best regards, Thomas -- Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
Quoted 4 lines
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20171215/2f508195/attachment.html>
A message that is not in the archive (sent off-list or not yet received): CABukmmN5UjdWupf_8zuCkx13tuNVFxeD9AOE=cemfQ_Soe1AUQ@mail.gmail.com
PATCH 2/2 enable static linking for libfuse
Hello,
Quoted 6 lines · A EP
yeah that's intentional. musl doesn't actually have separate libs. the empty libraries are just for compatibility.
i don't think dlopen actually works in static musl, it might just return 0. libfuse works fine for me, because it only uses dlopen for exotic modules stuff.
Then if you want to be able to have support for libfuse in static builds in Buildroot, libfuse should only conditionally use dlopen(), if available.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 1/2 DTPMOD mod fix for musl's rcrt0
In reply to Arvid E. PiccianiHello,
Thanks for your contribution!
package/musl/0002-fix-rcrt1.o.patch
Quoted 13 lines · Arvid E. Picciani
See https://github.com/rust-lang/rust/issues/46566
Signed-off-by Arvid E. Picciani <[email protected]>--- package/musl/0002-fix-rcrt1.o.patch | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 package/musl/0002-fix-rcrt1.o.patchpackage/musl/0002-fix-rcrt1.o.patch new file +0
-0
All patches need a description and a Signed-off-by. Also is this patch in upstream musl? Has it been submitted?
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com