toolchain/musl: export libc_so.a for mklibs mklibs
authorFelix Fietkau <nbd@nbd.name>
Mon, 11 Dec 2017 10:34:10 +0000 (11:34 +0100)
committerFelix Fietkau <nbd@nbd.name>
Wed, 13 Dec 2017 10:28:37 +0000 (11:28 +0100)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
toolchain/musl/Makefile
toolchain/musl/patches/310-build-shared-libc-a.patch [new file with mode: 0644]

index 2b9312bcbf123c03cf8947c52044557e27377e79..8cb743c8cd141db62a47cd380aca962ba7abc22f 100644 (file)
@@ -25,6 +25,7 @@ endef
 define Host/Install
        $(call Host/SetToolchainInfo)
        +$(MAKE) $(HOST_JOBS) $(MUSL_MAKEOPTS) DESTDIR="$(TOOLCHAIN_DIR)/" install
+       $(CP) $(HOST_BUILD_DIR)/lib/libc_so.a $(TOOLCHAIN_DIR)/lib/
        $(CP) ./include $(TOOLCHAIN_DIR)/
 endef
 
diff --git a/toolchain/musl/patches/310-build-shared-libc-a.patch b/toolchain/musl/patches/310-build-shared-libc-a.patch
new file mode 100644 (file)
index 0000000..7f6e616
--- /dev/null
@@ -0,0 +1,23 @@
+--- a/Makefile
++++ b/Makefile
+@@ -66,7 +66,7 @@ CRT_LIBS = $(addprefix lib/,$(notdir $(C
+ STATIC_LIBS = lib/libc.a
+ SHARED_LIBS = lib/libc.so
+ TOOL_LIBS = lib/musl-gcc.specs
+-ALL_LIBS = $(CRT_LIBS) $(STATIC_LIBS) $(SHARED_LIBS) $(EMPTY_LIBS) $(TOOL_LIBS) lib/libssp_nonshared.a
++ALL_LIBS = $(CRT_LIBS) $(STATIC_LIBS) $(SHARED_LIBS) $(EMPTY_LIBS) $(TOOL_LIBS) lib/libssp_nonshared.a lib/libc_so.a
+ ALL_TOOLS = obj/musl-gcc
+ WRAPCC_GCC = gcc
+@@ -168,6 +168,11 @@ lib/libc.so: $(LOBJS) $(LDSO_OBJS)
+       $(CC) $(CFLAGS_ALL) $(LDFLAGS_ALL) -nostdlib -shared \
+       -Wl,-e,_dlstart -o $@ $(LOBJS) $(LDSO_OBJS) $(LIBCC)
++lib/libc_so.a: $(LOBJS) $(LDSO_OBJS)
++      rm -f $@
++      $(AR) rc $@ $(LOBJS) $(LDSO_OBJS)
++      $(RANLIB) $@
++
+ lib/libc.a: $(AOBJS)
+       rm -f $@
+       $(AR) rc $@ $(AOBJS)