toolchain/musl: update to version 1.1.20
[openwrt/staging/mkresin.git] / toolchain / musl / patches / 200-add_libssp_nonshared.patch
index 7a2909461b3859e498f488a61d419f75ab828c95..b8fa7b4b4f3c155b61d9d34b169b0ac14fe9ab20 100644 (file)
@@ -4,11 +4,6 @@ Date: Mon, 22 Jun 2015 11:01:56 +0200
 Subject: [PATCH] Add libssp_nonshared.a so GCC's is not needed
 
 Signed-off-by: Steven Barth <steven@midlink.org>
----
- Makefile                                  | 10 ++++++++--
- libssp_nonshared/__stack_chk_fail_local.c |  2 ++
- 2 files changed, 10 insertions(+), 2 deletions(-)
- create mode 100644 libssp_nonshared/__stack_chk_fail_local.c
 
 --- a/Makefile
 +++ b/Makefile
@@ -21,21 +16,29 @@ Signed-off-by: Steven Barth <steven@midlink.org>
  ALL_TOOLS = obj/musl-gcc
  
  WRAPCC_GCC = gcc
-@@ -125,7 +125,8 @@ NOSSP_SRCS = $(wildcard crt/*.c) \
-       src/thread/__set_thread_area.c src/thread/$(ARCH)/__set_thread_area.c \
-       src/string/memset.c src/string/$(ARCH)/memset.c \
-       src/string/memcpy.c src/string/$(ARCH)/memcpy.c \
--      ldso/dlstart.c ldso/dynlink.c
-+      ldso/dlstart.c ldso/dynlink.c \
-+      src/libssp_nonshared/__stack_chk_fail_local.c
- $(NOSSP_SRCS:%.c=obj/%.o) $(NOSSP_SRCS:%.c=obj/%.lo): CFLAGS_ALL += $(CFLAGS_NOSSP)
- $(CRT_OBJS): CFLAGS_ALL += -DCRT
-@@ -168,6 +169,11 @@ lib/libc.a: $(AOBJS)
+@@ -86,7 +86,7 @@ else
+ all: $(ALL_LIBS) $(ALL_TOOLS)
+-OBJ_DIRS = $(sort $(patsubst %/,%,$(dir $(ALL_LIBS) $(ALL_TOOLS) $(ALL_OBJS) $(GENH) $(GENH_INT))) obj/include)
++OBJ_DIRS = $(sort $(patsubst %/,%,$(dir $(ALL_LIBS) $(ALL_TOOLS) $(ALL_OBJS) $(GENH) $(GENH_INT))) obj/include obj/libssp_nonshared)
+ $(ALL_LIBS) $(ALL_TOOLS) $(ALL_OBJS) $(ALL_OBJS:%.o=%.lo) $(GENH) $(GENH_INT): | $(OBJ_DIRS)
+
+@@ -113,6 +113,8 @@ obj/crt/rcrt1.o: $(srcdir)/ldso/dlstart.
+ obj/crt/Scrt1.o obj/crt/rcrt1.o: CFLAGS_ALL += -fPIC
++obj/libssp_nonshared/__stack_chk_fail_local.o: CFLAGS_ALL += $(CFLAGS_NOSSP)
++
+ OPTIMIZE_SRCS = $(wildcard $(OPTIMIZE_GLOBS:%=$(srcdir)/src/%))
+ $(OPTIMIZE_SRCS:$(srcdir)/%.c=obj/%.o) $(OPTIMIZE_SRCS:$(srcdir)/%.c=obj/%.lo): CFLAGS += -O3
+@@ -165,6 +166,11 @@ lib/libc.a: $(AOBJS)
        $(AR) rc $@ $(AOBJS)
        $(RANLIB) $@
  
-+lib/libssp_nonshared.a: obj/src/libssp_nonshared/__stack_chk_fail_local.o
++lib/libssp_nonshared.a: obj/libssp_nonshared/__stack_chk_fail_local.o
 +      rm -f $@
 +      $(AR) rc $@ $<
 +      $(RANLIB) $@
@@ -44,7 +47,7 @@ Signed-off-by: Steven Barth <steven@midlink.org>
        rm -f $@
        $(AR) rc $@
 --- /dev/null
-+++ b/src/libssp_nonshared/__stack_chk_fail_local.c
++++ b/libssp_nonshared/__stack_chk_fail_local.c
 @@ -0,0 +1,2 @@
 +#include "atomic.h"
 +void __attribute__((visibility ("hidden"))) __stack_chk_fail_local(void) { a_crash(); }