Skip to content
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

Use wasm opt #193

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Use wasm opt #193

wants to merge 2 commits into from

Conversation

limemloh
Copy link
Contributor

Purpose

Use wasm-opt in cargo concordium when building to workaround the issue of concordium smart contract runtime not supporting 5 bytes encodings of zero in certain places introduced in LLVM 19 (Rust 1.82)

@limemloh limemloh requested review from td202 and DOBEN January 15, 2025 12:25
Copy link
Member

@DOBEN DOBEN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested the new version on several smart contracts. LGTM.

Copy link

@td202 td202 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently this produces a linker error on Windows that we probably need to figure out how to resolve:

  = note: C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\Thomas\Documents\concordium\concordium-smart-contract-tools\cargo-concordium\target\release\deps\libwasm_opt_sys-43fb2d296010354e.rlib(33c8a920b262e069-wasm-validator.o):wasm-validator:(.text$_ZN4wasm4Pass13runOnFunctionEPNS_6ModuleEPNS_8FunctionE+0x0): multiple definition of `wasm::Pass::runOnFunction(wasm::Module*, wasm::Function*)'; C:\Users\Thomas\Documents\concordium\concordium-smart-contract-tools\cargo-concordium\target\release\deps\libwasm_opt_cxx_sys-29cb707347905cdf.rlib(aeea60e054e9ce5c-lib.rs.o):lib.rs.cc:(.text$_ZN4wasm4Pass13runOnFunctionEPNS_6ModuleEPNS_8FunctionE[_ZN4wasm4Pass13runOnFunctionEPNS_6ModuleEPNS_8FunctionE]+0x0): first defined here␍
          C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\Thomas\Documents\concordium\concordium-smart-contract-tools\cargo-concordium\target\release\deps\libwasm_opt_sys-43fb2d296010354e.rlib(33c8a920b262e069-wasm-validator.o):wasm-validator:(.text$_ZN4wasm4Pass3runEPNS_6ModuleE+0x0): multiple definition of `wasm::Pass::run(wasm::Module*)'; C:\Users\Thomas\Documents\concordium\concordium-smart-contract-tools\cargo-concordium\target\release\deps\libwasm_opt_cxx_sys-29cb707347905cdf.rlib(aeea60e054e9ce5c-lib.rs.o):lib.rs.cc:(.text$_ZN4wasm4Pass3runEPNS_6ModuleE[_ZN4wasm4Pass3runEPNS_6ModuleE]+0x0): first defined here␍
          C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\Thomas\Documents\concordium\concordium-smart-contract-tools\cargo-concordium\target\release\deps\libwasm_opt_sys-43fb2d296010354e.rlib(33c8a920b262e069-wasm-validator.o):wasm-validator:(.text$_ZN4wasm4Pass6createEv+0x0): multiple definition of `wasm::Pass::create()'; C:\Users\Thomas\Documents\concordium\concordium-smart-contract-tools\cargo-concordium\target\release\deps\libwasm_opt_cxx_sys-29cb707347905cdf.rlib(aeea60e054e9ce5c-lib.rs.o):lib.rs.cc:(.text$_ZN4wasm4Pass6createEv[_ZN4wasm4Pass6createEv]+0x0): first defined here␍
          collect2.exe: error: ld returned 1 exit status

Comment on lines +239 to +242
wasm_opt::OptimizationOptions::new_optimize_for_size()
.run(&filename, &filename)
.context("Failed running wasm_opt")?;

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that we should optimize here. Isn't this liable to break reproducible builds?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants