Commit Graph

16 Commits

Author SHA1 Message Date
Dan Gohman
a280fead2a
Move math source files. (#151)
This is split out from the LTO change. It's needed by the LTO build so
that we can easily build these files in non-LTO mode, since they satisfy
calls emitted by LLVM codegen after LTO.
2019-12-20 15:43:31 -08:00
Dan Gohman
cf81683e77
Optimize fmin, fmax, etc. (#120)
Use wasm's builtin min and max operators to implement libc `fmin`,
`fmax, `fminf`, and `fmaxf`, by handling the NaN cases explicitly.

Credit to https://github.com/emscripten-core/emscripten/pull/9689
for spotting this opportunity!
2019-11-20 11:13:45 -08:00
Dan Gohman
ca9046d872
Use consistent style for wasi-libc C source files. (#131)
For now, this means using `//`-style comments in .c source files (though
not public header files), and spaces rather than tabs. No strong opinion
here; this is just what the majority of the current code is using.

This also synchronizes basics/crt/crt1.c with libc-bottom-half's
version, though this is just a cleanup as the former isn't currently used
by the main wasi-libc build.
2019-11-08 11:59:57 -08:00
Dan Gohman
ec3ee5e985
Avoid using user identifiers in function declarations. (#124)
MultiSource/Benchmarks/McCat in llvm-test-suite has a macro named
`n`, so rename function parameters to avoid colliding.
2019-10-28 11:08:12 -07:00
Dan Gohman
7d5074ff66 Add complex builtins for creal and cimag too. 2019-05-15 11:52:56 -07:00
Dan Gohman
16450763eb Use builtin functions rather than portable libm implementations.
For functions like sqrt, fabs, and others, use the builtin functions,
which provide single-instruction implementations, rather than using
musl's portable implementations.
2019-05-15 11:52:56 -07:00
Dan Gohman
c87e877f88 Move abort.c out of libc-bottom-half and into basics. 2019-05-07 11:34:41 -07:00
Dan Gohman
ad03c82d65 Implement reallocarray.
reallocarray is non-standard but present in GLIBC and BSDs.
2019-04-23 15:00:07 -07:00
Dan Gohman
4646d29abc Make basics include guard names more consistent. 2019-04-15 09:47:16 -07:00
Dan Gohman
ad22a59013 Add a basics implementation of <inttypes.h>.
Musl's generic definitions for PRIxPTR and several others in
<inttypes.h> are incorrect for wasm, so introduce a new <inttypes.h>
and <__header_inttypes.h> in the basics module using compiler-provided
definitions.

Fixes #13.
2019-04-15 09:44:33 -07:00
Dan Gohman
320054e84f WASI libc prototype implementation.
This incoporates pieces from musl-libc, cloudlibc, cloudabi, libpreopen,
and dlmalloc, as well as a significant amount of new code.
2019-03-27 07:59:55 -07:00
eliasbenali
0e98504240 Fix ssize_t redefinition mismatch. (#10)
* Fix ssize_t redefinition mismatch.

Align definition with comment and previous define in __typedef_ssize_t.h

* Fix __typedef_ssize_t.h, redundancy in sys/types.h
2019-03-20 19:24:58 -07:00
Dan Gohman
dbfccac2e4 Add a malloc implementation using dlmalloc. 2019-01-10 15:42:34 -08:00
Dan Gohman
51d4922df8 Add a definition of struct stat and supporting types.
This `struct stat` matches the x32 and x86-64 definitions.
2019-01-02 20:37:21 -08:00
Dan Gohman
26722dc857 Add typedefs for suseconds_t and nlink_t. 2019-01-02 16:01:05 -08:00
Dan Gohman
dcf13b6fc4 Add initial files.
This populates the repo with a very minimal set of files. This is just
enough to set out a basic outline. Hopefully as we move forward we'll
be replacing many of these parts, but this is just something basic to
get things started.

This tree isn't really usable yet, as it doesn't yet have an easy way
to obtain a compiler-rt/libgcc build.
2018-10-02 17:48:36 -07:00