musl: update to 1.1.12 + git from 2016-01-22
[openwrt/staging/chunkeey.git] / toolchain / musl / patches / 200-add_libssp_nonshared.patch
1 From 7ec87fbbc3cac99b4173d082dd6195f47c9a32e7 Mon Sep 17 00:00:00 2001
2 From: Steven Barth <steven@midlink.org>
3 Date: Mon, 22 Jun 2015 11:01:56 +0200
4 Subject: [PATCH] Add libssp_nonshared.a so GCC's is not needed
5
6 Signed-off-by: Steven Barth <steven@midlink.org>
7 ---
8 Makefile | 10 ++++++++--
9 libssp_nonshared/__stack_chk_fail_local.c | 2 ++
10 2 files changed, 10 insertions(+), 2 deletions(-)
11 create mode 100644 libssp_nonshared/__stack_chk_fail_local.c
12
13 --- a/Makefile
14 +++ b/Makefile
15 @@ -56,7 +56,7 @@ CRT_LIBS = lib/crt1.o lib/Scrt1.o lib/rc
16 STATIC_LIBS = lib/libc.a
17 SHARED_LIBS = lib/libc.so
18 TOOL_LIBS = lib/musl-gcc.specs
19 -ALL_LIBS = $(CRT_LIBS) $(STATIC_LIBS) $(SHARED_LIBS) $(EMPTY_LIBS) $(TOOL_LIBS)
20 +ALL_LIBS = $(CRT_LIBS) $(STATIC_LIBS) $(SHARED_LIBS) $(EMPTY_LIBS) $(TOOL_LIBS) lib/libssp_nonshared.a
21 ALL_TOOLS = obj/musl-gcc
22
23 WRAPCC_GCC = gcc
24 @@ -117,7 +117,8 @@ NOSSP_SRCS = $(wildcard crt/*.c) \
25 src/env/__libc_start_main.c src/env/__init_tls.c \
26 src/thread/__set_thread_area.c src/env/__stack_chk_fail.c \
27 src/string/memset.c src/string/memcpy.c \
28 - src/ldso/dlstart.c src/ldso/dynlink.c
29 + src/ldso/dlstart.c src/ldso/dynlink.c \
30 + src/libssp_nonshared/__stack_chk_fail_local.c
31 $(NOSSP_SRCS:%.c=obj/%.o) $(NOSSP_SRCS:%.c=obj/%.lo): CFLAGS_ALL += $(CFLAGS_NOSSP)
32
33 $(CRT_LIBS:lib/%=obj/crt/%): CFLAGS_ALL += -DCRT
34 @@ -161,6 +162,11 @@ lib/libc.a: $(OBJS)
35 $(AR) rc $@ $(OBJS)
36 $(RANLIB) $@
37
38 +lib/libssp_nonshared.a: obj/src/libssp_nonshared/__stack_chk_fail_local.o
39 + rm -f $@
40 + $(AR) rc $@ $<
41 + $(RANLIB) $@
42 +
43 $(EMPTY_LIBS):
44 rm -f $@
45 $(AR) rc $@
46 --- /dev/null
47 +++ b/src/libssp_nonshared/__stack_chk_fail_local.c
48 @@ -0,0 +1,2 @@
49 +#include "atomic.h"
50 +void __attribute__((visibility ("hidden"))) __stack_chk_fail_local(void) { a_crash(); }