1
0

200-add_libssp_nonshared.patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. Signed-off-by: Steven Barth <steven@midlink.org>
  6. ---
  7. Makefile | 10 ++++++++--
  8. libssp_nonshared/__stack_chk_fail_local.c | 2 ++
  9. 2 files changed, 10 insertions(+), 2 deletions(-)
  10. create mode 100644 libssp_nonshared/__stack_chk_fail_local.c
  11. --- a/Makefile
  12. +++ b/Makefile
  13. @@ -66,7 +66,7 @@ CRT_LIBS = $(addprefix lib/,$(notdir $(C
  14. STATIC_LIBS = lib/libc.a
  15. SHARED_LIBS = lib/libc.so
  16. TOOL_LIBS = lib/musl-gcc.specs
  17. -ALL_LIBS = $(CRT_LIBS) $(STATIC_LIBS) $(SHARED_LIBS) $(EMPTY_LIBS) $(TOOL_LIBS)
  18. +ALL_LIBS = $(CRT_LIBS) $(STATIC_LIBS) $(SHARED_LIBS) $(EMPTY_LIBS) $(TOOL_LIBS) lib/libssp_nonshared.a
  19. ALL_TOOLS = obj/musl-gcc
  20. WRAPCC_GCC = gcc
  21. @@ -129,7 +129,8 @@ NOSSP_SRCS = $(wildcard crt/*.c) \
  22. src/thread/__set_thread_area.c src/thread/$(ARCH)/__set_thread_area.c \
  23. src/string/memset.c src/string/$(ARCH)/memset.c \
  24. src/string/memcpy.c src/string/$(ARCH)/memcpy.c \
  25. - ldso/dlstart.c ldso/dynlink.c
  26. + ldso/dlstart.c ldso/dynlink.c \
  27. + src/libssp_nonshared/__stack_chk_fail_local.c
  28. $(NOSSP_SRCS:%.c=obj/%.o) $(NOSSP_SRCS:%.c=obj/%.lo): CFLAGS_ALL += $(CFLAGS_NOSSP)
  29. $(CRT_OBJS): CFLAGS_ALL += -DCRT
  30. @@ -172,6 +173,11 @@ lib/libc.a: $(AOBJS)
  31. $(AR) rc $@ $(AOBJS)
  32. $(RANLIB) $@
  33. +lib/libssp_nonshared.a: obj/src/libssp_nonshared/__stack_chk_fail_local.o
  34. + rm -f $@
  35. + $(AR) rc $@ $<
  36. + $(RANLIB) $@
  37. +
  38. $(EMPTY_LIBS):
  39. rm -f $@
  40. $(AR) rc $@
  41. --- /dev/null
  42. +++ b/src/libssp_nonshared/__stack_chk_fail_local.c
  43. @@ -0,0 +1,2 @@
  44. +#include "atomic.h"
  45. +void __attribute__((visibility ("hidden"))) __stack_chk_fail_local(void) { a_crash(); }