473 Commits

Author SHA1 Message Date
Sam Clegg
b7d5c4aaea typo 2017-11-06 14:16:41 -08:00
Sam Clegg
26774d0b17 fixes 2017-11-03 16:32:03 -07:00
Sam Clegg
857ceeb10a Have wasm.js create fixed size memory and export it to all modules
Build must.wasm such that it imports the same size (16Mb)
memory.

This re-enables the pseudo-dynamic linking abilities of wasm.js
2017-11-03 15:28:24 -07:00
Sam Clegg
3458d4e67b [WebAssembly] Fix shared library loading
The ffi mapping was not being correctly populated
Fixing this actaully causes a lot more failures
on the waterfall because we don't currently share
memory between the modules.
2017-11-03 09:44:07 -07:00
Sam Clegg
319abd03d4
Add --dump-ffi-symbols argument to wasm.js (#5)
This allows a list of all symbols exports by wasm.js to be
generated which is usefull for passing to my prototype of
lld which takes an --allow-undefined-symbols=<filename>
argument.
2017-10-30 17:37:48 -07:00
Sam Clegg
a7161e9449 [WebAssembly] Exclude less in libc.py 2017-10-27 14:39:51 -07:00
JF Bastien
46cf4c8640 Merge pull request #11 from sbc100/add_letf2
[WebAssembly] Add llvm builting '__letf2' to wasm.js
2017-10-20 16:46:44 -07:00
Sam Clegg
96aea19aae [WebAssembly] Updaet alltypes.h.in 2017-10-20 16:21:39 -07:00
Sam Clegg
addf7f9215 [WebAssembly] Add llvm builting '__letf2' to wasm.js 2017-10-20 13:33:55 -07:00
Sam Clegg
94500fb127 [WebAssembly] Enable building with 'make' command
This change enables all of the .c sources in musl
be built with the clang -target wasm32-unknown-unknown-wasm
2017-10-19 17:42:50 -07:00
Heejin Ahn
30930bef22 Fix bugs in strcmp/strncmp/strchr
Added strcmp/strncmp implementations that follow the libc spec, and
fixed a bug in strchr. This makes a couple more tests pass in Wasm
waterfall.
2017-08-22 15:46:51 -07:00
JF Bastien
128cf2eece Use read if readbuffer is unavailable 2017-01-02 15:10:34 -08:00
Derek Schuff
39fde6042e Update wasm.js loader to use new WebAssembly JS API 2016-10-26 13:34:58 -07:00
Derek Schuff
2a717f2d43 Add __stdio_write and __stdout_write to musl_hack list of imports
They are now imported because they are address-taken
2016-07-14 09:11:35 -07:00
Derek Schuff
cff987a27b Update wasm.js for v8's change to 2-level FFI namespace 2016-03-08 15:30:28 -08:00
Derek Schuff
cd50df76d4 Use the new exports table on the wasm module object 2016-02-29 13:45:25 -08:00
Derek Schuff
3f4c233ac0 Use 16MB for the linear memory array buffer
Some of the torture tests use big stacks, and 16 is enough larger than 2.
2016-02-18 15:35:14 -08:00
JF Bastien
1648814783 Add clrsbl clrsbll as well 2016-02-14 14:08:20 -08:00
JF Bastien
49dbb74456 Add __builtin_clrsb as NYI
builtin-bitops-1.c now hits it.
2016-02-13 13:57:29 -08:00
JF Bastien
968d8d2158 Improve trap handling, fix isspace. 2016-02-03 08:30:55 -08:00
JF Bastien
7f1742a8c3 Fix reference error. 2016-02-03 04:26:30 -08:00
JF Bastien
682407e272 dlsym: use same pattern as other loader
It's still broken because call_indirect requires a function in the same module.
2016-02-01 09:22:50 -08:00
JF Bastien
8bbb33957b Handle main() not returning EXIT_SUCCESS. 2016-02-01 08:26:21 -08:00
JF Bastien
f73845c1b8 Typo. 2016-02-01 08:05:12 -08:00
JF Bastien
acc1d6453b dlfcn.h implementation and detailed example. 2016-02-01 08:00:42 -08:00
JF Bastien
13f9666606 Stub dlfcn.h 2016-02-01 04:54:06 -08:00
JF Bastien
26e7adf5d0 wasm objects don't have hasOwnProperty and functions aren't Function 2016-01-31 02:49:24 -08:00
JF Bastien
ae7274db9b Add a few todos. 2016-01-30 14:12:19 -08:00
JF Bastien
f11387c0bb Return -1 from syscall stubs. 2016-01-30 13:45:37 -08:00
JF Bastien
e1f64b81c3 Add wasm.js
Imported from: https://github.com/WebAssembly/waterfall/blob/master/src/test/wasm.js
Hash: 8074c23c566a65f32d6b7fac065abf1ffca95473
2016-01-30 09:08:51 -08:00
JF Bastien
0861c7123e Hack around the import argument mismatch
sexpr-wasm rightfully complained that the imports weren't called with the right signatures. I'm not sure how the syscall macro layering works, but this hack works for now.
2016-01-30 06:45:11 -08:00
JF Bastien
52a00611c2 Hack around syscalls. 2016-01-30 02:27:36 -08:00
JF Bastien
317fa55ab1 Fixes. 2016-01-28 11:05:27 -08:00
JF Bastien
273da2708f Import arch/wasm32 from emscripten 2016-01-28 11:04:59 -08:00
Rich Felker
e7a1118984 fix arm a_crash for big endian
contrary to commit 89e149d275a7699a4a5e4c98bab267648f64cbba, big
endian arm does need the instruction bytes in big endian order. rather
than trying to use a special encoding that works as arm or thumb,
simply encode the simplest/canonical undefined instructions dependent
on whether __thumb__ is defined.
2016-01-25 21:59:55 +00:00
Rich Felker
89e149d275 add native a_crash primitive for arm
the .byte directive encodes a guaranteed-undefined instruction, the
same one Linux fills the kuser helper page with when it's disabled.
the udf mnemonic and and .insn directives are not supported by old
binutils versions, and larger-than-byte integer directives would
produce the wrong output on big-endian.
2016-01-25 02:44:56 +00:00
Szabolcs Nagy
bc443c3fe3 clean powerpc syscall.h
remove ifdefs for powerpc64.
2016-01-24 19:08:57 -05:00
Szabolcs Nagy
f9c3a2e048 add missing powerpc specific PROT_SAO memory protection flag
this flag for strong access ordering was added in linux v2.6.27
commit aba46c5027cb59d98052231b36efcbbde9c77a1d
2016-01-24 19:08:40 -05:00
Szabolcs Nagy
2f6f3dccb4 fix powerpc MCL_* mlockall flags in bits/mman.h
the definitions didn't match the linux uapi headers.
2016-01-24 19:08:19 -05:00
Szabolcs Nagy
2d14fa39b0 fix aarch64 atomics to load/store 32bit only
a_ll/a_sc inline asm used 64bit register operands (%0) instead of 32bit
ones (%w0), this at least broke a_and_64 (which always cleared the top
32bit, leaking memory in malloc).
2016-01-24 19:07:35 -05:00
Rich Felker
b17fbd3520 improve aarch64 atomics
aarch64 provides ll/sc variants with acquire/release memory order,
freeing us from the need to have full barriers both before and after
the ll/sc operation. previously they were not used because the a_cas
can fail without performing a_sc, in which case half of the barrier
would be omitted. instead, define a custom version of a_cas for
aarch64 which uses a_barrier explicitly when aborting the cas
operation. aside from cas, other operations built on top of ll/sc are
not affected since they never abort but rather loop until they
succeed.

a split ll/sc version of the pointer-sized a_cas_p is also introduced
using the same technique.

patch by Szabolcs Nagy.
2016-01-23 14:03:40 -05:00
Rich Felker
4de1bc1164 remove sh port's __fpscr_values source file
commit f3ddd173806fd5c60b3f034528ca24542aecc5b9, the dynamic linker
bootstrap overhaul, silently disabled the definition of __fpscr_values
in this file since libc.so's copy of __fpscr_values now comes from
crt_arch.h, the same place the public definition in the main program's
crt1.o ultimately comes from. remove this file which is no longer in
use.
2016-01-22 03:50:58 +00:00
Rich Felker
007907a93c move sh port's __shcall internal function from arch/sh/src to src tree 2016-01-22 03:50:08 +00:00
Rich Felker
230bfe1a7d move sh __unmapself code from arch/sh/src to main src tree 2016-01-22 03:46:00 +00:00
Rich Felker
66215afc2e move x32 sysinfo impl and syscall fixup code out of arch/x32/src
all such arch-specific translation units are being moved to
appropriate arch dirs under the main src tree.
2016-01-22 03:39:07 +00:00
Rich Felker
513c043694 overhaul powerpc atomics for new atomics framework
previously powerpc had a_cas defined in terms of its native ll/sc
style operations, but all other atomics were defined in terms of
a_cas. instead define a_ll and a_sc so the compiler can generate
optimized versions of all the atomic ops and perform better inlining
of a_cas.

extracting the result of the sc (stwcx.) instruction is rather awkward
because it's natively stored in a condition flag, which is not
representable in inline asm. but even with this limitation the new
code still seems significantly better.
2016-01-22 02:58:32 +00:00
Rich Felker
16b55298dc clean up x86_64 (and x32) atomics for new atomics framework
this commit mostly makes consistent things like spacing, function
ordering in atomic_arch.h, argument names, use of volatile, etc.
a_ctz_l was also removed from x86_64 since atomic.h provides it
automatically using a_ctz_64.
2016-01-22 00:53:09 +00:00
Rich Felker
e24984efd5 clean up i386 atomics for new atomics framework
this commit mostly makes consistent things like spacing, function
ordering in atomic_arch.h, argument names, use of volatile, etc. the
fake 64-bit and/or atomics are also removed because the shared
atomic.h does a better job of implementing them; it avoids making two
atomic memory accesses when only one 32-bit half needs to be touched.

no major overhaul is needed or possible because x86 actually has
native versions of all the usual atomic operations, rather than using
ll/sc or needing cas loops.
2016-01-22 00:16:53 +00:00
Rich Felker
369b22f9c4 overhaul mips atomics for new atomics framework 2016-01-22 00:10:40 +00:00
Rich Felker
e617b9eea9 move arm-specific translation units out of arch/arm/src, to src/*/arm
this is possible with the new build system that allows src/*/$(ARCH)/*
files which do not shadow a file in the parent directory, and yields a
more logical organization. eventually it will be possible to remove
arch/*/src from the build system.
2016-01-22 00:02:21 +00:00