- Notifications
You must be signed in to change notification settings - Fork967
compiler: link .syso files found in Go package directories#4593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:dev
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
While this is one option, I don't think we should be going for this solution. The reason is that Do you have any objections against a special-purpose pragma for this purpose? It would basically just add the file to the linker, nothing else. Also, since this is going to be generated code and the uglyness is hidden, I don't see any fundamental reason why the |
Among other things, this enables WebAssembly programs to link in custom sections,which can be stored in a relocatable wasm module with a .syso suffix in a package directory.This will simplify the build process for WASI 0.2, removing the need to run'wasm-tools component embed' with the original source WIT files.
Currently stubbed out (if false). Depends ontinygo-org/tinygo#4593
The Cgo hack can’t be used because it creates a circular dependency on package What if I limited this PR to just |
Yeah, you're right.
Limiting to wasm would indeed help against my worries. Or even only accepting a single filename (I don't know, something like |
One complication: -Target=wasip2 sets GOARCH=arm GOOS=linux. This means that foo_wasm.syso would not be found. Do you have any plans to change the GOARCH/GOOS handling for architectures that TinyGo supports that Go doesn't? |
Currently stubbed out (if false). Depends ontinygo-org/tinygo#4593
This enables WIT tree-shaking by world or interface, as a precursor for Go package-level component metadata.wit/bindgen: oopswit/bindgen: add WIT generation for each WIT interface (Go package)Currently disabled.wit/bindgen: cgo + linker tricks WIPwit: fix typowit/bindgen: typowit: type aliases force transitive dependency on the dependencies of their parent interfacewit: prepare for filtering interface contentswit: remove ConstrainTointernal/wasm: stub linking sectionwit/bindgen: generate .wasm.syso files in each Go packageCurrently stubbed out (if false). Depends ontinygo-org/tinygo#4593wit: revise package sorting algorithmThis enables wasi:http to sort before wasi:cli.wit/bindgen: more cleanup (path -> pkgPath)wit/bindgen: optionally generate WIT files for each Go packagecmd/wit-bindgen-go: --generate-wit option to generate WIT files for each Go packagewit/bindgen: generate synthetic worlds in the go:bindgen package namespace
We can't, really. We use |
Uh oh!
There was an error while loading.Please reload this page.
This is an experiment, driven by a need to link in custom sections into the resulting .wasm binary. Using a .syso file in a package directory is a well-known way to accomplish this with other architectures in big Go.
We have a POC that proves this works:ydnar/wasi-http-go#13
Another example:https://tip.golang.org/src/crypto/internal/boring/syso/
@dgryski co-authored this live at WasmCon.