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

Add LLVM's opt tool to cargo contract build #22

Closed
Robbepop opened this issue Feb 1, 2020 · 4 comments
Closed

Add LLVM's opt tool to cargo contract build #22

Robbepop opened this issue Feb 1, 2020 · 4 comments

Comments

@Robbepop
Copy link
Contributor

Robbepop commented Feb 1, 2020

At the moment ink! smart contracts have all their panic messages included in the data segment of the Wasm binary even though execution aborts upon panic and will never output any panic messages.

This is due to a "bug" between Rust and LLVM translation.
We can manually optimize this superflous data away with LLVM's opt tool.
The passes we need to enable from it are:

The opt tool usage should be enabled by default, however, if it does not exist on a user machine the build process should simply do what it currently does (not use opt) and print a warning to the user stating that the resulting Wasm binary might not be optimal for the given reason.

@pepyakin
Copy link
Contributor

pepyakin commented Feb 3, 2020

Note, that I was using a matching versions of LLVM and rustc. I am not sure that it will work if the versions of rustc's LLVM and LLVM of opt mismatch.

@ascjones
Copy link
Collaborator

ascjones commented Feb 3, 2020

Can you provide a pseudo build.sh for this.

Or even better a non pseudo one that works.

@pepyakin
Copy link
Contributor

pepyakin commented Feb 3, 2020

I am afraid that I don't have anything at hand and the best info can be only found at the original issue.

@Robbepop
Copy link
Contributor Author

This can be closed since we found a much better solution to solve the underlying problem via Xargo.

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

No branches or pull requests

3 participants