Skip to content

Conversation

kubkon
Copy link
Member

@kubkon kubkon commented May 21, 2021

Produce static lib by default

This matches the behaviour for other targets in that

> zig build-lib math.zig -target wasm32-freestanding
libmath.a

produces now libmath.a while

> zig build-lib math.zig -dynamic -target wasm32-freestanding
math.wasm

is required to create a loadable Wasm module.

Rename produced object files to .o from .o.wasm

This should offer more compatibility with external tooling when cross-compiling to wasm with zig.

> zig build-obj hello.zig -target wasm32-freestanding
hello.o

This matches the behaviour for other targets in that

```
zig build-lib math.zig -target wasm32-freestanding
```

produces now `libmath.a` while

```
zig build-lib math.zig -dynamic -target wasm32-freestanding
```

is required to create a loadable Wasm module.
@kubkon kubkon added arch-wasm 32-bit and 64-bit WebAssembly os-freestanding os-wasi labels May 21, 2021
@kubkon kubkon added this to the 0.8.0 milestone May 21, 2021
@kubkon kubkon requested review from andrewrk and jedisct1 May 21, 2021 19:59
@kubkon kubkon added the breaking Implementing this issue could cause existing code to no longer compile or have different behavior. label May 21, 2021
This should offer more compatibility with external tooling when
cross-compiling to wasm with zig.
@kubkon kubkon changed the title wasm: build static archive unless -dynamic specified wasm: produce static lib by default and rename produced object files to simply .o from .o.wasm May 21, 2021
@jedisct1
Copy link
Contributor

Yes!

Consistency with other platforms and compilers is great.

Also, having a different extension for objects previously confused autoconf-generated scripts, that didn't see zig cc as gcc-compatible compiler any more.

@kubkon kubkon merged commit 9d311e9 into master May 22, 2021
@kubkon kubkon deleted the cc-wasm-ar branch May 22, 2021 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-wasm 32-bit and 64-bit WebAssembly breaking Implementing this issue could cause existing code to no longer compile or have different behavior. os-freestanding os-wasi
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants