Begin linker dev for issue #8

This commit is contained in:
Chad Retz
2017-06-08 11:55:03 -05:00
parent 43333edfd0
commit 3e912b2b15
20 changed files with 565 additions and 63 deletions

View File

@ -1,6 +1,6 @@
package run.jvm.emscripten;
import asmble.annotation.WasmName;
import asmble.annotation.WasmExport;
public class Common {
private final Env env;
@ -13,7 +13,7 @@ public class Common {
throw new UnsupportedOperationException();
}
@WasmName("__assert_fail")
@WasmExport("__assert_fail")
public void assertFail(int conditionPtr, int filenamePtr, int line, int funcPtr) {
throw new AssertionError("Assertion failed: " + env.mem.getCString(conditionPtr) + ", at " +
env.mem.getCString(filenamePtr) + ":" + line + ", func " + env.mem.getCString(funcPtr));
@ -29,12 +29,12 @@ public class Common {
return 0;
}
@WasmName("__cxa_call_unexpected")
@WasmExport("__cxa_call_unexpected")
public void callUnexpected(int ex) {
throw new EmscriptenException("Unexpected: " + ex);
}
@WasmName("__lock")
@WasmExport("__lock")
public void lock(int arg) {
throw new UnsupportedOperationException();
}
@ -43,7 +43,7 @@ public class Common {
throw new UnsupportedOperationException();
}
@WasmName("__unlock")
@WasmExport("__unlock")
public void unlock(int arg) {
throw new UnsupportedOperationException();
}

View File

@ -1,9 +1,7 @@
package run.jvm.emscripten;
import asmble.annotation.WasmName;
import asmble.annotation.WasmExport;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@ -23,12 +21,12 @@ public class Syscall {
this.env = env;
}
@WasmName("__syscall6")
@WasmExport("__syscall6")
public int close(int arg0, int arg1) {
throw new UnsupportedOperationException();
}
@WasmName("__syscall54")
@WasmExport("__syscall54")
public int ioctl(int which, int varargs) {
FStream fd = fd(env.getMemory().getInt(varargs));
IoctlOp op = IoctlOp.byNumber.get(env.getMemory().getInt(varargs + 4));
@ -52,12 +50,12 @@ public class Syscall {
}
}
@WasmName("__syscall140")
@WasmExport("__syscall140")
public int llseek(int arg0, int arg1) {
throw new UnsupportedOperationException();
}
@WasmName("__syscall146")
@WasmExport("__syscall146")
public int writev(int which, int varargs) {
FStream fd = fd(env.getMemory().getInt(varargs));
int iov = env.getMemory().getInt(varargs + 4);