support --target-arch wasm32 (#1094)
Add wasm32 support to the build-obj, build-exe and build-lib commands
of the stage 1 compiler. Wasm64 should work transparently once it's
supported in upstream LLVM.
To export a function:
// lib.zig - for exposition, not necessary for this example
pub use @import("add.zig");
// add.zig
export fn add(a: i32, b: i32) i32 {
return a + b;
}
To import a function:
// cube.zig
extern fn square(x: i32) i32;
export fn cube(x: i32) i32 {
return x * square(x);
}
This commit is contained in:
committed by
Andrew Kelley
parent
7a9635555b
commit
d464b25322
@@ -597,12 +597,15 @@ void resolve_target_object_format(ZigTarget *target) {
|
||||
case ZigLLVM_tce:
|
||||
case ZigLLVM_tcele:
|
||||
case ZigLLVM_thumbeb:
|
||||
case ZigLLVM_wasm32:
|
||||
case ZigLLVM_wasm64:
|
||||
case ZigLLVM_xcore:
|
||||
target->oformat= ZigLLVM_ELF;
|
||||
return;
|
||||
|
||||
case ZigLLVM_wasm32:
|
||||
case ZigLLVM_wasm64:
|
||||
target->oformat = ZigLLVM_Wasm;
|
||||
return;
|
||||
|
||||
case ZigLLVM_ppc:
|
||||
case ZigLLVM_ppc64:
|
||||
if (is_os_darwin(target)) {
|
||||
|
||||
Reference in New Issue
Block a user