musl: update to 1.1.12 + git from 2016-01-22

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48486
This commit is contained in:
Felix Fietkau 2016-01-25 12:42:00 +00:00
parent d9db303af6
commit 99419349e6
9 changed files with 8125 additions and 201 deletions

View File

@ -3,6 +3,6 @@ if USE_MUSL
config MUSL_VERSION config MUSL_VERSION
string string
depends on USE_MUSL depends on USE_MUSL
default "1.1.11" default "1.1.12"
endif endif

View File

@ -11,7 +11,7 @@ PKG_NAME:=musl
PKG_VERSION:=$(call qstrip,$(CONFIG_MUSL_VERSION)) PKG_VERSION:=$(call qstrip,$(CONFIG_MUSL_VERSION))
PKG_RELEASE=1 PKG_RELEASE=1
PKG_MD5SUM:=48be0777e32f374d387e9cf85e36ec4d PKG_MD5SUM:=42875e0c111aa1cb9d08663f8d42c799
PKG_SOURCE_URL:=http://www.musl-libc.org/releases PKG_SOURCE_URL:=http://www.musl-libc.org/releases
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz

File diff suppressed because it is too large Load Diff

View File

@ -1,55 +0,0 @@
From: Rich Felker <dalias@aerifal.cx>
Date: Tue, 29 Sep 2015 02:44:05 +0000
Subject: [PATCH] eliminate protected-visibility data in libc.so with vis.h
preinclude
some newer binutils versions print scary warnings about protected data
because most gcc versions fail to produce the right address
references/relocations for such data that might be subject to copy
relocations. originally vis.h explicitly assigned default visibility
to all public data symbols to avoid this issue, but commit
b8dda24fe1caa901a99580f7a52defb95aedb67c removed this treatment for
stdin/out/err to work around a gcc 3.x bug, and since they don't
actually need it (because taking their addresses is not valid C).
instead, a check for the gcc 3.x bug is added to the configure check
for vis.h preinclude support; this feature will simply be disabled
when using a buggy version of gcc.
---
--- a/configure
+++ b/configure
@@ -476,10 +476,18 @@ if test "x$visibility" = xauto ; then
# - the -include option
# - the attributes/pragmas used in vis.h
# - linking code that takes the address of protected symbols
+# - gcc 3.x bug that wrongly claims declarations mismatch
printf "checking whether global visibility preinclude works... "
-echo 'int (*fp)(void);' > "$tmpc"
-echo 'int foo(void) { }' >> "$tmpc"
-echo 'int bar(void) { fp = foo; return foo(); }' >> "$tmpc"
+cat > "$tmpc" <<EOF
+__attribute__((__visibility__("default")))
+extern struct a *const x;
+typedef struct a b;
+extern b *const x;
+b *const x;
+int (*fp)(void);
+int foo(void) { }
+int bar(void) { fp = foo; return foo(); }
+EOF
if $CC $CFLAGS_C99FSE $CPPFLAGS $CFLAGS \
-DSHARED -fPIC -I./src/internal -include vis.h \
-nostdlib -shared -Wl,-Bsymbolic-functions \
--- a/src/internal/vis.h
+++ b/src/internal/vis.h
@@ -12,6 +12,9 @@
* exported data symbols. */
__attribute__((__visibility__("default")))
+extern struct _IO_FILE *const stdin, *const stdout, *const stderr;
+
+__attribute__((__visibility__("default")))
extern int optind, opterr, optopt, optreset, __optreset, getdate_err, h_errno, daylight, __daylight, signgam, __signgam;
__attribute__((__visibility__("default")))

View File

@ -11,12 +11,26 @@ Make it possible to run these devices in soft-float mode.
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Felix Fietkau <nbd@openwrt.org>
--- ---
create mode 100644 src/fenv/powerpc-sf/fenv.sub create mode 100644 src/fenv/powerpc/fenv-sf.c
create mode 100644 src/setjmp/powerpc-sf/longjmp.s
create mode 100644 src/setjmp/powerpc-sf/longjmp.sub
create mode 100644 src/setjmp/powerpc-sf/setjmp.s
create mode 100644 src/setjmp/powerpc-sf/setjmp.sub
--- a/arch/powerpc/bits/fenv.h
+++ b/arch/powerpc/bits/fenv.h
@@ -1,3 +1,7 @@
+#ifdef _SOFT_FLOAT
+#define FE_ALL_EXCEPT 0
+#define FE_TONEAREST 0
+#else
#define FE_TONEAREST 0
#define FE_TOWARDZERO 1
#define FE_UPWARD 2
@@ -24,6 +28,7 @@
#define FE_ALL_INVALID 0x01f80700
#endif
+#endif
typedef unsigned fexcept_t;
typedef double fenv_t;
--- a/arch/powerpc/reloc.h --- a/arch/powerpc/reloc.h
+++ b/arch/powerpc/reloc.h +++ b/arch/powerpc/reloc.h
@@ -1,4 +1,10 @@ @@ -1,4 +1,10 @@
@ -33,7 +47,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
--- a/configure --- a/configure
+++ b/configure +++ b/configure
@@ -538,6 +538,10 @@ trycppif "_MIPSEL || __MIPSEL || __MIPSE @@ -595,6 +595,10 @@ trycppif "_MIPSEL || __MIPSEL || __MIPSE
trycppif __mips_soft_float "$t" && SUBARCH=${SUBARCH}-sf trycppif __mips_soft_float "$t" && SUBARCH=${SUBARCH}-sf
fi fi
@ -45,31 +59,293 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
&& SUBARCH=${SUBARCH}el && SUBARCH=${SUBARCH}el
--- /dev/null --- /dev/null
+++ b/src/fenv/powerpc-sf/fenv.sub +++ b/src/fenv/powerpc/fenv-sf.c
@@ -0,0 +1 @@ @@ -0,0 +1,3 @@
+../fenv.c +#ifdef _SOFT_FLOAT
+#include "../fenv.c"
+#endif
--- /dev/null --- /dev/null
+++ b/src/setjmp/powerpc-sf/longjmp.s +++ b/src/fenv/powerpc/fenv.S
@@ -0,0 +1,47 @@ @@ -0,0 +1,129 @@
+#ifndef _SOFT_FLOAT
+.global feclearexcept
+.type feclearexcept,@function
+feclearexcept:
+ andis. 3,3,0x3e00
+ /* if (r3 & FE_INVALID) r3 |= all_invalid_flags */
+ andis. 0,3,0x2000
+ stwu 1,-16(1)
+ beq- 0,1f
+ oris 3,3,0x01f8
+ ori 3,3,0x0700
+1:
+ /*
+ * note: fpscr contains various fpu status and control
+ * flags and we dont check if r3 may alter other flags
+ * than the exception related ones
+ * ufpscr &= ~r3
+ */
+ mffs 0
+ stfd 0,8(1)
+ lwz 9,12(1)
+ andc 9,9,3
+ stw 9,12(1)
+ lfd 0,8(1)
+ mtfsf 255,0
+
+ /* return 0 */
+ li 3,0
+ addi 1,1,16
+ blr
+
+.global feraiseexcept
+.type feraiseexcept,@function
+feraiseexcept:
+ andis. 3,3,0x3e00
+ /* if (r3 & FE_INVALID) r3 |= software_invalid_flag */
+ andis. 0,3,0x2000
+ stwu 1,-16(1)
+ beq- 0,1f
+ ori 3,3,0x0400
+1:
+ /* fpscr |= r3 */
+ mffs 0
+ stfd 0,8(1)
+ lwz 9,12(1)
+ or 9,9,3
+ stw 9,12(1)
+ lfd 0,8(1)
+ mtfsf 255,0
+
+ /* return 0 */
+ li 3,0
+ addi 1,1,16
+ blr
+
+.global fetestexcept
+.type fetestexcept,@function
+fetestexcept:
+ andis. 3,3,0x3e00
+ /* return r3 & fpscr */
+ stwu 1,-16(1)
+ mffs 0
+ stfd 0,8(1)
+ lwz 9,12(1)
+ addi 1,1,16
+ and 3,3,9
+ blr
+
+.global fegetround
+.type fegetround,@function
+fegetround:
+ /* return fpscr & 3 */
+ stwu 1,-16(1)
+ mffs 0
+ stfd 0,8(1)
+ lwz 3,12(1)
+ addi 1,1,16
+ clrlwi 3,3,30
+ blr
+
+.global __fesetround
+.type __fesetround,@function
+__fesetround:
+ /*
+ * note: invalid input is not checked, r3 < 4 must hold
+ * fpscr = (fpscr & -4U) | r3
+ */
+ stwu 1,-16(1)
+ mffs 0
+ stfd 0,8(1)
+ lwz 9,12(1)
+ clrrwi 9,9,2
+ or 9,9,3
+ stw 9,12(1)
+ lfd 0,8(1)
+ mtfsf 255,0
+
+ /* return 0 */
+ li 3,0
+ addi 1,1,16
+ blr
+
+.global fegetenv
+.type fegetenv,@function
+fegetenv:
+ /* *r3 = fpscr */
+ mffs 0
+ stfd 0,0(3)
+ /* return 0 */
+ li 3,0
+ blr
+
+.global fesetenv
+.type fesetenv,@function
+fesetenv:
+ cmpwi 3, -1
+ bne 1f
+ mflr 4
+ bl 2f
+ .zero 8
+2: mflr 3
+ mtlr 4
+1: /* fpscr = *r3 */
+ lfd 0,0(3)
+ mtfsf 255,0
+ /* return 0 */
+ li 3,0
+ blr
+#endif
--- a/src/fenv/powerpc/fenv.s
+++ /dev/null
@@ -1,123 +0,0 @@
-.global feclearexcept
-.type feclearexcept,@function
-feclearexcept:
- andis. 3,3,0x3e00
- # if (r3 & FE_INVALID) r3 |= all_invalid_flags
- andis. 0,3,0x2000
- stwu 1,-16(1)
- beq- 0,1f
- oris 3,3,0x01f8
- ori 3,3,0x0700
-1:
- # note: fpscr contains various fpu status and control
- # flags and we dont check if r3 may alter other flags
- # than the exception related ones
- # fpscr &= ~r3
- mffs 0
- stfd 0,8(1)
- lwz 9,12(1)
- andc 9,9,3
- stw 9,12(1)
- lfd 0,8(1)
- mtfsf 255,0
-
- # return 0
- li 3,0
- addi 1,1,16
- blr
-
-.global feraiseexcept
-.type feraiseexcept,@function
-feraiseexcept:
- andis. 3,3,0x3e00
- # if (r3 & FE_INVALID) r3 |= software_invalid_flag
- andis. 0,3,0x2000
- stwu 1,-16(1)
- beq- 0,1f
- ori 3,3,0x0400
-1:
- # fpscr |= r3
- mffs 0
- stfd 0,8(1)
- lwz 9,12(1)
- or 9,9,3
- stw 9,12(1)
- lfd 0,8(1)
- mtfsf 255,0
-
- # return 0
- li 3,0
- addi 1,1,16
- blr
-
-.global fetestexcept
-.type fetestexcept,@function
-fetestexcept:
- andis. 3,3,0x3e00
- # return r3 & fpscr
- stwu 1,-16(1)
- mffs 0
- stfd 0,8(1)
- lwz 9,12(1)
- addi 1,1,16
- and 3,3,9
- blr
-
-.global fegetround
-.type fegetround,@function
-fegetround:
- # return fpscr & 3
- stwu 1,-16(1)
- mffs 0
- stfd 0,8(1)
- lwz 3,12(1)
- addi 1,1,16
- clrlwi 3,3,30
- blr
-
-.global __fesetround
-.type __fesetround,@function
-__fesetround:
- # note: invalid input is not checked, r3 < 4 must hold
- # fpscr = (fpscr & -4U) | r3
- stwu 1,-16(1)
- mffs 0
- stfd 0,8(1)
- lwz 9,12(1)
- clrrwi 9,9,2
- or 9,9,3
- stw 9,12(1)
- lfd 0,8(1)
- mtfsf 255,0
-
- # return 0
- li 3,0
- addi 1,1,16
- blr
-
-.global fegetenv
-.type fegetenv,@function
-fegetenv:
- # *r3 = fpscr
- mffs 0
- stfd 0,0(3)
- # return 0
- li 3,0
- blr
-
-.global fesetenv
-.type fesetenv,@function
-fesetenv:
- cmpwi 3, -1
- bne 1f
- mflr 4
- bl 2f
- .zero 8
-2: mflr 3
- mtlr 4
-1: # fpscr = *r3
- lfd 0,0(3)
- mtfsf 255,0
- # return 0
- li 3,0
- blr
--- /dev/null
+++ b/src/setjmp/powerpc/longjmp.S
@@ -0,0 +1,69 @@
+ .global _longjmp + .global _longjmp
+ .global longjmp + .global longjmp
+ .type _longjmp,@function + .type _longjmp,@function
+ .type longjmp,@function + .type longjmp,@function
+_longjmp: +_longjmp:
+longjmp: +longjmp:
+# void longjmp(jmp_buf env, int val); + /*
+# put val into return register and restore the env saved in setjmp + * void longjmp(jmp_buf env, int val);
+# if val(r4) is 0, put 1 there. + * put val into return register and restore the env saved in setjmp
+ # 0) move old return address into r0 + * if val(r4) is 0, put 1 there.
+ */
+ /* 0) move old return address into r0 */
+ lwz 0, 0(3) + lwz 0, 0(3)
+ # 1) put it into link reg + /* 1) put it into link reg */
+ mtlr 0 + mtlr 0
+ #2 ) restore stack ptr + /* 2 ) restore stack ptr */
+ lwz 1, 4(3) + lwz 1, 4(3)
+ #3) restore control reg + /* 3) restore control reg */
+ lwz 0, 8(3) + lwz 0, 8(3)
+ mtcr 0 + mtcr 0
+ #4) restore r14-r31 + /* 4) restore r14-r31 */
+ lwz 14, 12(3) + lwz 14, 12(3)
+ lwz 15, 16(3) + lwz 15, 16(3)
+ lwz 16, 20(3) + lwz 16, 20(3)
@ -88,23 +364,107 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+ lwz 29, 72(3) + lwz 29, 72(3)
+ lwz 30, 76(3) + lwz 30, 76(3)
+ lwz 31, 80(3) + lwz 31, 80(3)
+ #5) put val into return reg r3 +#ifndef _SOFT_FLOAT
+ lfd 14,88(3)
+ lfd 15,96(3)
+ lfd 16,104(3)
+ lfd 17,112(3)
+ lfd 18,120(3)
+ lfd 19,128(3)
+ lfd 20,136(3)
+ lfd 21,144(3)
+ lfd 22,152(3)
+ lfd 23,160(3)
+ lfd 24,168(3)
+ lfd 25,176(3)
+ lfd 26,184(3)
+ lfd 27,192(3)
+ lfd 28,200(3)
+ lfd 29,208(3)
+ lfd 30,216(3)
+ lfd 31,224(3)
+#endif
+ /* 5) put val into return reg r3 */
+ mr 3, 4 + mr 3, 4
+ +
+ #6) check if return value is 0, make it 1 in that case + /* 6) check if return value is 0, make it 1 in that case */
+ cmpwi cr7, 4, 0 + cmpwi cr7, 4, 0
+ bne cr7, 1f + bne cr7, 1f
+ li 3, 1 + li 3, 1
+1: +1:
+ blr + blr
+ +
--- a/src/setjmp/powerpc/longjmp.s
+++ /dev/null
@@ -1,65 +0,0 @@
- .global _longjmp
- .global longjmp
- .type _longjmp,@function
- .type longjmp,@function
-_longjmp:
-longjmp:
-# void longjmp(jmp_buf env, int val);
-# put val into return register and restore the env saved in setjmp
-# if val(r4) is 0, put 1 there.
- # 0) move old return address into r0
- lwz 0, 0(3)
- # 1) put it into link reg
- mtlr 0
- #2 ) restore stack ptr
- lwz 1, 4(3)
- #3) restore control reg
- lwz 0, 8(3)
- mtcr 0
- #4) restore r14-r31
- lwz 14, 12(3)
- lwz 15, 16(3)
- lwz 16, 20(3)
- lwz 17, 24(3)
- lwz 18, 28(3)
- lwz 19, 32(3)
- lwz 20, 36(3)
- lwz 21, 40(3)
- lwz 22, 44(3)
- lwz 23, 48(3)
- lwz 24, 52(3)
- lwz 25, 56(3)
- lwz 26, 60(3)
- lwz 27, 64(3)
- lwz 28, 68(3)
- lwz 29, 72(3)
- lwz 30, 76(3)
- lwz 31, 80(3)
- lfd 14,88(3)
- lfd 15,96(3)
- lfd 16,104(3)
- lfd 17,112(3)
- lfd 18,120(3)
- lfd 19,128(3)
- lfd 20,136(3)
- lfd 21,144(3)
- lfd 22,152(3)
- lfd 23,160(3)
- lfd 24,168(3)
- lfd 25,176(3)
- lfd 26,184(3)
- lfd 27,192(3)
- lfd 28,200(3)
- lfd 29,208(3)
- lfd 30,216(3)
- lfd 31,224(3)
- #5) put val into return reg r3
- mr 3, 4
-
- #6) check if return value is 0, make it 1 in that case
- cmpwi cr7, 4, 0
- bne cr7, 1f
- li 3, 1
-1:
- blr
-
--- /dev/null --- /dev/null
+++ b/src/setjmp/powerpc-sf/longjmp.sub +++ b/src/setjmp/powerpc/setjmp.S
@@ -0,0 +1 @@ @@ -0,0 +1,63 @@
+longjmp.s
--- /dev/null
+++ b/src/setjmp/powerpc-sf/setjmp.s
@@ -0,0 +1,43 @@
+ .global ___setjmp + .global ___setjmp
+ .hidden ___setjmp + .hidden ___setjmp
+ .global __setjmp + .global __setjmp
@ -117,15 +477,15 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+__setjmp: +__setjmp:
+_setjmp: +_setjmp:
+setjmp: +setjmp:
+ # 0) store IP int 0, then into the jmpbuf pointed to by r3 (first arg) + /* 0) store IP int 0, then into the jmpbuf pointed to by r3 (first arg) */
+ mflr 0 + mflr 0
+ stw 0, 0(3) + stw 0, 0(3)
+ # 1) store reg1 (SP) + /* 1) store reg1 (SP) */
+ stw 1, 4(3) + stw 1, 4(3)
+ # 2) store cr + /* 2) store cr */
+ mfcr 0 + mfcr 0
+ stw 0, 8(3) + stw 0, 8(3)
+ # 3) store r14-31 + /* 3) store r14-31 */
+ stw 14, 12(3) + stw 14, 12(3)
+ stw 15, 16(3) + stw 15, 16(3)
+ stw 16, 20(3) + stw 16, 20(3)
@ -144,11 +504,91 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+ stw 29, 72(3) + stw 29, 72(3)
+ stw 30, 76(3) + stw 30, 76(3)
+ stw 31, 80(3) + stw 31, 80(3)
+ # 4) set return value to 0 +#ifndef _SOFT_FLOAT
+ stfd 14,88(3)
+ stfd 15,96(3)
+ stfd 16,104(3)
+ stfd 17,112(3)
+ stfd 18,120(3)
+ stfd 19,128(3)
+ stfd 20,136(3)
+ stfd 21,144(3)
+ stfd 22,152(3)
+ stfd 23,160(3)
+ stfd 24,168(3)
+ stfd 25,176(3)
+ stfd 26,184(3)
+ stfd 27,192(3)
+ stfd 28,200(3)
+ stfd 29,208(3)
+ stfd 30,216(3)
+ stfd 31,224(3)
+#endif
+ /* 4) set return value to 0 */
+ li 3, 0 + li 3, 0
+ # 5) return + /* 5) return */
+ blr + blr
--- /dev/null --- a/src/setjmp/powerpc/setjmp.s
+++ b/src/setjmp/powerpc-sf/setjmp.sub +++ /dev/null
@@ -0,0 +1 @@ @@ -1,61 +0,0 @@
+setjmp.s - .global ___setjmp
- .hidden ___setjmp
- .global __setjmp
- .global _setjmp
- .global setjmp
- .type __setjmp,@function
- .type _setjmp,@function
- .type setjmp,@function
-___setjmp:
-__setjmp:
-_setjmp:
-setjmp:
- # 0) store IP int 0, then into the jmpbuf pointed to by r3 (first arg)
- mflr 0
- stw 0, 0(3)
- # 1) store reg1 (SP)
- stw 1, 4(3)
- # 2) store cr
- mfcr 0
- stw 0, 8(3)
- # 3) store r14-31
- stw 14, 12(3)
- stw 15, 16(3)
- stw 16, 20(3)
- stw 17, 24(3)
- stw 18, 28(3)
- stw 19, 32(3)
- stw 20, 36(3)
- stw 21, 40(3)
- stw 22, 44(3)
- stw 23, 48(3)
- stw 24, 52(3)
- stw 25, 56(3)
- stw 26, 60(3)
- stw 27, 64(3)
- stw 28, 68(3)
- stw 29, 72(3)
- stw 30, 76(3)
- stw 31, 80(3)
- stfd 14,88(3)
- stfd 15,96(3)
- stfd 16,104(3)
- stfd 17,112(3)
- stfd 18,120(3)
- stfd 19,128(3)
- stfd 20,136(3)
- stfd 21,144(3)
- stfd 22,152(3)
- stfd 23,160(3)
- stfd 24,168(3)
- stfd 25,176(3)
- stfd 26,184(3)
- stfd 27,192(3)
- stfd 28,200(3)
- stfd 29,208(3)
- stfd 30,216(3)
- stfd 31,224(3)
- # 4) set return value to 0
- li 3, 0
- # 5) return
- blr

View File

@ -1,79 +0,0 @@
From 7b9f57f207b51132f188f750161953b7baf32154 Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
Date: Thu, 8 Oct 2015 22:03:53 +0000
Subject: fix open_[w]memstream behavior when no writes take place
the specification for these functions requires that the buffer/size
exposed to the caller be valid after any successful call to fflush or
fclose on the stream. the implementation's approach is to update them
only at flush time, but that misses the case where fflush or fclose is
called without any writes having taken place, in which case the write
flushing callback will not be called.
to fix both the observable bug and the desired invariant, setup empty
buffers at open time and fail the open operation if no memory is
available.
---
src/stdio/open_memstream.c | 11 +++++++++--
src/stdio/open_wmemstream.c | 11 +++++++++--
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/stdio/open_memstream.c b/src/stdio/open_memstream.c
index 58504c9..eab024d 100644
--- a/src/stdio/open_memstream.c
+++ b/src/stdio/open_memstream.c
@@ -59,14 +59,21 @@ FILE *open_memstream(char **bufp, size_t *sizep)
{
FILE *f;
struct cookie *c;
+ char *buf;
+
if (!(f=malloc(sizeof *f + sizeof *c + BUFSIZ))) return 0;
+ if (!(buf=malloc(sizeof *buf))) {
+ free(f);
+ return 0;
+ }
memset(f, 0, sizeof *f + sizeof *c);
f->cookie = c = (void *)(f+1);
c->bufp = bufp;
c->sizep = sizep;
- c->pos = c->len = c->space = 0;
- c->buf = 0;
+ c->pos = c->len = c->space = *sizep = 0;
+ c->buf = *bufp = buf;
+ *buf = 0;
f->flags = F_NORD;
f->fd = -1;
diff --git a/src/stdio/open_wmemstream.c b/src/stdio/open_wmemstream.c
index 7ab2c64..4d90cd9 100644
--- a/src/stdio/open_wmemstream.c
+++ b/src/stdio/open_wmemstream.c
@@ -61,14 +61,21 @@ FILE *open_wmemstream(wchar_t **bufp, size_t *sizep)
{
FILE *f;
struct cookie *c;
+ wchar_t *buf;
+
if (!(f=malloc(sizeof *f + sizeof *c))) return 0;
+ if (!(buf=malloc(sizeof *buf))) {
+ free(f);
+ return 0;
+ }
memset(f, 0, sizeof *f + sizeof *c);
f->cookie = c = (void *)(f+1);
c->bufp = bufp;
c->sizep = sizep;
- c->pos = c->len = c->space = 0;
- c->buf = 0;
+ c->pos = c->len = c->space = *sizep = 0;
+ c->buf = *bufp = buf;
+ *buf = 0;
f->flags = F_NORD;
f->fd = -1;
--
cgit v0.11.2

View File

@ -12,30 +12,30 @@ Signed-off-by: Steven Barth <steven@midlink.org>
--- a/Makefile --- a/Makefile
+++ b/Makefile +++ b/Makefile
@@ -48,7 +48,7 @@ CRT_LIBS = lib/crt1.o lib/Scrt1.o lib/rc @@ -56,7 +56,7 @@ CRT_LIBS = lib/crt1.o lib/Scrt1.o lib/rc
STATIC_LIBS = lib/libc.a STATIC_LIBS = lib/libc.a
SHARED_LIBS = lib/libc.so SHARED_LIBS = lib/libc.so
TOOL_LIBS = lib/musl-gcc.specs TOOL_LIBS = lib/musl-gcc.specs
-ALL_LIBS = $(CRT_LIBS) $(STATIC_LIBS) $(SHARED_LIBS) $(EMPTY_LIBS) $(TOOL_LIBS) -ALL_LIBS = $(CRT_LIBS) $(STATIC_LIBS) $(SHARED_LIBS) $(EMPTY_LIBS) $(TOOL_LIBS)
+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
ALL_TOOLS = tools/musl-gcc ALL_TOOLS = obj/musl-gcc
WRAPCC_GCC = gcc WRAPCC_GCC = gcc
@@ -106,7 +106,8 @@ NOSSP_SRCS = $(wildcard crt/*.c) \ @@ -117,7 +117,8 @@ NOSSP_SRCS = $(wildcard crt/*.c) \
src/env/__libc_start_main.c src/env/__init_tls.c \ src/env/__libc_start_main.c src/env/__init_tls.c \
src/thread/__set_thread_area.c src/env/__stack_chk_fail.c \ src/thread/__set_thread_area.c src/env/__stack_chk_fail.c \
src/string/memset.c src/string/memcpy.c \ src/string/memset.c src/string/memcpy.c \
- src/ldso/dlstart.c src/ldso/dynlink.c - src/ldso/dlstart.c src/ldso/dynlink.c
+ src/ldso/dlstart.c src/ldso/dynlink.c \ + src/ldso/dlstart.c src/ldso/dynlink.c \
+ libssp_nonshared/__stack_chk_fail_local.c + src/libssp_nonshared/__stack_chk_fail_local.c
$(NOSSP_SRCS:%.c=%.o) $(NOSSP_SRCS:%.c=%.lo): CFLAGS += $(CFLAGS_NOSSP) $(NOSSP_SRCS:%.c=obj/%.o) $(NOSSP_SRCS:%.c=obj/%.lo): CFLAGS_ALL += $(CFLAGS_NOSSP)
$(CRT_LIBS:lib/%=crt/%): CFLAGS += -DCRT $(CRT_LIBS:lib/%=obj/crt/%): CFLAGS_ALL += -DCRT
@@ -155,6 +156,11 @@ lib/libc.a: $(OBJS) @@ -161,6 +162,11 @@ lib/libc.a: $(OBJS)
$(AR) rc $@ $(OBJS) $(AR) rc $@ $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
+lib/libssp_nonshared.a: libssp_nonshared/__stack_chk_fail_local.o +lib/libssp_nonshared.a: obj/src/libssp_nonshared/__stack_chk_fail_local.o
+ rm -f $@ + rm -f $@
+ $(AR) rc $@ $< + $(AR) rc $@ $<
+ $(RANLIB) $@ + $(RANLIB) $@
@ -44,7 +44,7 @@ Signed-off-by: Steven Barth <steven@midlink.org>
rm -f $@ rm -f $@
$(AR) rc $@ $(AR) rc $@
--- /dev/null --- /dev/null
+++ b/libssp_nonshared/__stack_chk_fail_local.c +++ b/src/libssp_nonshared/__stack_chk_fail_local.c
@@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
+#include "atomic.h" +#include "atomic.h"
+void __attribute__((visibility ("hidden"))) __stack_chk_fail_local(void) { a_crash(); } +void __attribute__((visibility ("hidden"))) __stack_chk_fail_local(void) { a_crash(); }

View File

@ -1,6 +1,6 @@
--- a/Makefile --- a/Makefile
+++ b/Makefile +++ b/Makefile
@@ -195,7 +195,7 @@ $(DESTDIR)$(includedir)/%: include/% @@ -210,7 +210,7 @@ $(DESTDIR)$(includedir)/%: $(srcdir)/inc
$(INSTALL) -D -m 644 $< $@ $(INSTALL) -D -m 644 $< $@
$(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so $(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so

View File

@ -1,18 +0,0 @@
--- a/src/network/getifaddrs.c
+++ b/src/network/getifaddrs.c
@@ -161,6 +161,15 @@ static int netlink_msg_to_ifaddr(void *p
ifs->ifa.ifa_flags = ifs0->ifa.ifa_flags;
for (rta = NLMSG_RTA(h, sizeof(*ifa)); NLMSG_RTAOK(rta, h); rta = RTA_NEXT(rta)) {
switch (rta->rta_type) {
+ case IFA_LOCAL:
+ /* If ifa_addr is set and we get IFA_LOCAL, assume we have
+ * a point-to-point network. Move address to correct field. */
+ if (ifs->ifa.ifa_addr != NULL) {
+ ifs->ifu = ifs->addr;
+ ifs->ifa.ifa_broadaddr = &ifs->ifu.sa;
+ memset(&ifs->addr, 0, sizeof(ifs->addr));
+ }
+ /* fall through */
case IFA_ADDRESS:
copy_addr(&ifs->ifa.ifa_addr, ifa->ifa_family, &ifs->addr, RTA_DATA(rta), RTA_DATALEN(rta), ifa->ifa_index);
break;