diff options
author | Bruce Mitchener <bruce.mitchener@gmail.com> | 2014-01-14 09:44:15 +0700 |
---|---|---|
committer | Bruce Mitchener <bruce.mitchener@gmail.com> | 2014-01-14 15:05:20 +0700 |
commit | a15486ffea916f46cca822d7614a44e48393b8d7 (patch) | |
tree | f47b7437e5a3f81f9a13ef1b5be45e5e5c59cf8e | |
parent | ea5facf1ab2c769e07b4046c6ed7257c2a8caf5c (diff) |
Fix asm2 compilation where __toread was used.
-rwxr-xr-x | emcc | 1 | ||||
-rw-r--r-- | system/lib/libc.symbols | 3 | ||||
-rw-r--r-- | system/lib/libc/musl/readme.txt | 2 | ||||
-rw-r--r-- | system/lib/libc/musl/src/stdio/__toread.c | 10 | ||||
-rw-r--r-- | system/lib/libc/musl/src/stdio/__towrite.c | 18 |
5 files changed, 21 insertions, 13 deletions
@@ -1462,6 +1462,7 @@ try: ['stdio', [ '__overflow.c', '__toread.c', + '__towrite.c', '__uflow.c', ]], ['stdlib', [ diff --git a/system/lib/libc.symbols b/system/lib/libc.symbols index 04fb40d6..eac87f0b 100644 --- a/system/lib/libc.symbols +++ b/system/lib/libc.symbols @@ -41,14 +41,13 @@ W _ZnwjRKSt9nothrow_t T __floatscan T __overflow - T __seek_on_exit T __shgetc T __shlim W __strtod_l W __strtof_l W __strtold_l T __toread - W __towrite_used + T __towrite T __uflow T _err T _errx diff --git a/system/lib/libc/musl/readme.txt b/system/lib/libc/musl/readme.txt index 7ad89449..02f3396a 100644 --- a/system/lib/libc/musl/readme.txt +++ b/system/lib/libc/musl/readme.txt @@ -10,4 +10,4 @@ Differences from upstream musl include: * Disable FLOCK, FUNLOCK and FFINALLOCK * Simplify fputwc to not rely on musl stream internals * signgam is no longer a weak alias of __signgam. - +* __toread and __towrite have had shutdown functionality removed. diff --git a/system/lib/libc/musl/src/stdio/__toread.c b/system/lib/libc/musl/src/stdio/__toread.c index 2e804f64..f00cc467 100644 --- a/system/lib/libc/musl/src/stdio/__toread.c +++ b/system/lib/libc/musl/src/stdio/__toread.c @@ -12,13 +12,3 @@ int __toread(FILE *f) f->rpos = f->rend = f->buf; return 0; } - -static const int dummy = 0; -weak_alias(dummy, __towrite_used); - -void __stdio_exit(void); - -void __seek_on_exit() -{ - if (!__towrite_used) __stdio_exit(); -} diff --git a/system/lib/libc/musl/src/stdio/__towrite.c b/system/lib/libc/musl/src/stdio/__towrite.c new file mode 100644 index 00000000..3698d8b7 --- /dev/null +++ b/system/lib/libc/musl/src/stdio/__towrite.c @@ -0,0 +1,18 @@ +#include "stdio_impl.h" + +int __towrite(FILE *f) +{ + f->mode |= f->mode-1; + if (f->flags & (F_NOWR)) { + f->flags |= F_ERR; + return EOF; + } + /* Clear read buffer (easier than summoning nasal demons) */ + f->rpos = f->rend = 0; + + /* Activate write through the buffer. */ + f->wpos = f->wbase = f->buf; + f->wend = f->buf + f->buf_size; + + return 0; +} |