-
Notifications
You must be signed in to change notification settings - Fork 824
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal to simplify create-obj / create-exe #3436
Comments
I think the proposal is more complicated than it should. Why? Because it forces us to save the whole directory structure on the backend. I'm aware we already do that, but it opens for other complications such as defining the entrypoint or doing other stuff. Basically,
As an optimization, we can call
The functions in each of the object files should probably be prefixed with the |
Use case: WABTOne package, multiple wasm files:
Steps1. Create objThe backend detects what are the atoms inside of the package: wasmer create-obj wat2wasm.wasm --prefix=sha123123 -o /tmp/wat2wasm.o # the sha is SHA256(wat2wasm.wasm) wasmer create-obj wasm2wat.wasm --prefix=sha223123 -o /tmp/wasm2wat.o # the sha is SHA256(wasm2wat.wasm) wasmer create-obj myfile.webc --atom=wasm2wat --prefix=sha223123 -o /tmp/wasm2wat.o # the sha is SHA256(wasm2wat.wasm) wasmer create-obj myfile.webc --prefix=sha223123 -o /tmp/wasm2wat.o # the sha is SHA256(wasm2wat.wasm)
# Error: specify the atom that you would like to compile What is prefix?Whenever the
... 2. Generate C header file
2. Create exeThe backend detects what are the atoms inside of the package:
Example:
Only on the last step is where create-exe creates the internal directory (similar to what it's doing now):
|
Right now the interaction between create-obj and create-exe is very cumbersome:
static_defs.h
filecc
To solve these issues and reduce the amout of if / else in
commands/create-exe.rs
, I propose refactoring the code like this:Simplify wasmer create-obj:
$OUTPUT_PATH/objects/{input_name}.o
--header-path
will be removed (header will always be written to$OUTPUT_DIR/headers/static_defs_{input_name}.h
)Simplify object format serialized + object format symbols
Simplify cross-compilation vs native compilation:
zig cc
or the nativeCC
(gcc, clang, etc) andzig build-exe
or the nativelld-link
--library-path
,--zig-binary-dir
or--target
is setlink.tar.gz
tarball from theWASMER_DIR
, then compile using that--tarball
Simplify feature flags:
static-artifact-create
andwebc_runner
flags (always enabled)The text was updated successfully, but these errors were encountered: