Commit Graph

101 Commits

Author SHA1 Message Date
Dan Gohman
33e8b5189b Omit musl's stdarg.h and stddef.h from the sysroot.
We already use the compiler's versions of these; this just moves from
having libc #include_next them to having libc just omit them entirely,
which is simpler.

This removes the special code to define musl's include guard, however
I originally added that when I was still working out how WASI's stddef.h
would interact with other code. I believe it's no longer important.
2019-10-07 08:59:24 -07:00
Dan Gohman
1f40984219 Factor out the include-file exclude list into a variable.
This also starts categorizing these headers into groups and adding
comments explaining their purpose.
2019-10-07 08:59:24 -07:00
Dan Gohman
447ea829a9 Add a CODE_OF_CONDUCT.md file. (#101) 2019-10-03 14:15:49 +02:00
Dan Gohman
c9a573306f Set the MALLOC_ALIGNMENT to 16.
This isn't strictly required, as wasm SIMD loads and stores work on
unaligned memory. However, it may provide better performance. That said,
this isn't currently studied by any benchmarking.
2019-09-07 07:22:18 -07:00
Sam Clegg
c35f0f5dd6 When checking undefined symbol list, ignore certain llvm buildins
These can vary between llvm version.  For example a recent upstream
change recently added __multi3 to the list:
https://reviews.llvm.org/D65143

Fixes #98
2019-08-29 20:39:11 -07:00
Dan Gohman
d498fc3ddf Fix a warning about a spurious redundant static keyword. 2019-08-29 10:27:41 -07:00
Dan Gohman
32cd170026 Update docs to say "libc" rather than "sysroot" where applicable. 2019-08-29 10:27:23 -07:00
Dan Gohman
b7ae2fe33b WASI libc's dirent does have t_type, so define _DIRENT_HAVE_D_TYPE.
Also update predefined-macros.txt.
2019-08-29 10:22:03 -07:00
Dan Gohman
bed0cb5d3a Fix _DIRENT_HAVE_D_* macros.
Don't define _DIRENT_HAVE_D_RECLEN or _DIRENT_HAVE_D_OFF, as WASI libc's
dirent doesn't have d_reclen or d_off.
2019-08-29 10:22:03 -07:00
Dan Gohman
7d2354e7d1 Disable the lseek optimization in C++.
The lseek optimization turns lseek calls into __wasilibc_tell calls when
possible, using macros and __builtin_constant_p. However, this isn't
safe in C++ code in the presence of namespaces and `using` declarations,
to just disable it in C++ for now.
2019-08-29 07:03:29 -07:00
Till Schneidereit
255e6f7c0d
Add Azure Pipelines definition (#78) 2019-08-12 13:50:53 +02:00
Dan Gohman
d4db3fa212 Update to musl 1.1.23.
See the WHATSNEW file for details; among other things, this contains new
math library implementation for log/exp/pow.
2019-08-07 17:53:41 -07:00
Sam Clegg
8df0d4cd6a Fix predefined macros check after recent clang change
This is an alternative to #75.
2019-07-16 07:12:28 -07:00
Dan Gohman
a413650013 Don't declare realpath or pseudo-terminal functions.
These functions are not currently defined, so suppress their declarations
in the headers.
2019-07-11 10:36:28 -07:00
Sam Clegg
94d34a13ad Update title in README.md 2019-06-24 10:27:17 -07:00
Sam Clegg
92eaf255a1 Ensure argv is null terminated.
This matches the behavior of populate __environ.

See #27
2019-05-30 08:15:23 -07:00
Dan Gohman
eee6ee7566 Don't declare popen and pclose. 2019-05-15 12:01:17 -07:00
Dan Gohman
84a2343ce4 Don't install <sys/xattr.h>, which isn't supported on WASI. 2019-05-15 12:01:17 -07:00
Dan Gohman
0a738e8fd6 Remove more declarations for symbols that aren't defined. 2019-05-15 12:01:17 -07:00
Dan Gohman
24f6fe1cc8 Don't declare lockfile and timezone functions.
These aren't defined, so don't declare them either.
2019-05-15 12:01:17 -07:00
Dan Gohman
6cddc9250b Implement truncate(2).
This adds a simple implementation of truncate in terms of open and
ftruncate.
2019-05-15 11:53:11 -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
Sam Clegg
1f7d798a3a
Don't create dummy libs for libc++/libc++abi (#68)
My understanding is that these dummy libs represent libraries who's
contents, under musl, live in libc itself rather than being split out
into separate libs.

libc++/libc++abi are not provided my musl so doesn't make sense to
pretend that we provide them.
2019-05-15 09:54:54 -07:00
Dan Gohman
5067fefb25 Implement more functions, remove more unimplemented headers.
Enable more musl sources for things tested in libc-test, and remove more
headers that aren't implemented on WASI.
2019-05-15 06:36:02 -07:00
Dan Gohman
256081f628 Move the mode_t macros into their own header.
This allows them to be defined by <fcntl.h> as well, as specified by
POSIX.

This fixes a part of src/api/fcntl.c.
2019-05-10 12:37:49 -07:00
Dan Gohman
861f0d2ec8 Define O_TTY_INIT.
Define it to 0, as several popular operating systems ignore this flag.

This fixes a part of src/api/fcntl.c.
2019-05-10 12:37:31 -07:00
Dan Gohman
a077330632 Update to libpreopen 8835639f27fc42d32096d59d294a0bbb857dc368.
This replaces our custom `unlink` wrapper with an upstream one. We still
end up replacing the entire body with local changes, but this makes it
easier to see what those changes are.

The other change here is a fix to ignore repeated '/'s in paths.
2019-05-09 09:16:56 -07:00
Dan Gohman
e369ade425 Fix fmemopen and friends to use the correct SEEK_* values.
WASI's values for SEEK_CUR, SEEK_SET, and SEEK_END differ from musl's
values, so fix musl code that bakes in knowledge of these values.

This fixes src/functional/memstream.c.
2019-05-09 09:16:38 -07:00
Dan Gohman
288738d194 Use the compiler's real/imag operators instead of union type punning.
This removes the last use of union type punning from WASI libc's
public header files.
2019-05-09 09:15:30 -07:00
Dan Gohman
900b8032b4 Remove __fpclassify and __signbit definitions.
With fpclassify and signbit now implemented as compiler builtins in a64f6544,
these out-of-line helper functions are no longer needed.
2019-05-09 09:15:30 -07:00
Dan Gohman
1dd59d8506 Use the compiler builtins for isless etc.
Building on a64f6544, use compiler builtins for isless, isgreater,
isunordered, and similar as well.
2019-05-09 09:15:30 -07:00
Dan Gohman
60cba39d11 Move the SEEK_* macros into their own header and use it from fcntl.h.
POSIX requires fcntl.h to define the SEEK_* macros, so this satisfies
that requirement. Also, this allows <stdio.h> to avoid including as much
unnecessary content.

This fixes one issue with src/api/fcntl.c.
2019-05-09 09:11:43 -07:00
Dan Gohman
1db93d1169 Switch from the cloudlibc inet_pton etc. to the musl versions.
These functions aren't specific to the underlying system call interface,
so they don't need to be in the "bottom half".

This also fixes src/functional/inet_pton.c and
src/regression/inet_pton-empty-last-field.c in musl's libc-test.
2019-05-09 09:10:57 -07:00
Dan Gohman
46ce01276f Don't declare dup in unistd.h.
Dup isn't defined in libc.a, so don't declare it.
2019-05-09 09:07:57 -07:00
Dan Gohman
e91e6dd766 Re-enable '%s' in strftime.
This was commented out earlier when timezone handling was more in flux,
but it's ok to minimally support this now.

This fixes src/functional/strftime.c in libc-test.
2019-05-09 09:07:38 -07:00
Dan Gohman
382b944a2e Rename __wasilibc_rmfileat to __wasilibc_unlinkat.
The POSIX terminology is that directories are "removed" while files
are "unlinked".
2019-05-07 15:04:17 -07:00
Dan Gohman
124f6a4d0a Add __restrict qualifiers to the fstatat declaration.
This makes it consistent with its definition.
2019-05-07 15:03:26 -07:00
Dan Gohman
07858345bc Ensure that environ is always initialized.
Initialize `environ` even if there are no environment variables, so that
it alwasy points to a NULL-terminated array even if that array just
contains the NULL. This fixes src/functional/env.c.
2019-05-07 11:35:48 -07:00
Dan Gohman
b40521edc3 Fix the return value of the first call to uselocale.
The first call to uselocale should return LC_GLOBAL_LOCALE. This fixes
src/regression/uselocale-0.c in libc-test.
2019-05-07 11:35:14 -07:00
Dan Gohman
c87e877f88 Move abort.c out of libc-bottom-half and into basics. 2019-05-07 11:34:41 -07:00
Frank Denis
b1e234b683 Document that WASM_NM and WASM_AR may also be required
Also make it explicit that we currently need clang 8+

Fixes #44
2019-05-06 13:32:45 -07:00
vms
d987aad467 use ENOMEM instead of EINVAL, set EINVAL if length == 0 2019-05-06 09:46:36 -07:00
vms
30e5a1fd1f move to __builtin_add_overflow 2019-05-06 09:46:36 -07:00
vms
ccfe4bda30 code deduplication 2019-05-06 09:46:36 -07:00
vms
4a8d1c7cf5 fix comment to correspond existing coding style 2019-05-06 09:46:36 -07:00
vms
20c48b57c7 fix mmap overflow and some other stuff 2019-05-06 09:46:36 -07:00
Sam Clegg
8e8cc34aad Makefile: Don't mix phony targets with directory names
Remove build rules for $(SYSROOT) and $(SYSROOT_INC).  The latter
becomes `include_dirs`.  The former is not needed, instead just add
startup_files to the finish rule.
2019-05-02 12:47:45 -07:00
vms
5ae626e99d delete a space in predefined-macros.txt 2019-05-02 08:06:39 -07:00
vms
a64f654488 replace some macros with its builtins analogs 2019-05-02 08:06:39 -07:00