Skip to content

Implement dummy llvm.returnaddress intrinsic #7634

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

Closed
atrosinenko opened this issue Dec 9, 2018 · 3 comments
Closed

Implement dummy llvm.returnaddress intrinsic #7634

atrosinenko opened this issue Dec 9, 2018 · 3 comments
Labels

Comments

@atrosinenko
Copy link
Contributor

When trying to implement Binaryen backend for QEMU (see WebAssembly/binaryen#1494), I got a crash because of the function llvm_returnaddress is not defined. From the documentation, looks like it is quite safe to make it always return 0.

As I understand, I cannot implement it in C, because it will get a _ prefix in its name. On the other hand, implementing it in JS seems to be not efficient (though, when I manually patched the generated .js file to make the llvm_returnaddress return 0, QEMU started correctly).

@atrosinenko atrosinenko changed the title Implement llvm.returnaddress intrinsic Implement dummy llvm.returnaddress intrinsic Dec 9, 2018
@kripken
Copy link
Member

kripken commented Dec 9, 2018

Defining it in src/library.js, as llvm_returnaddress: function() { return 0 },, should work ok (the prefix etc. will be handled for you) for testing purposes and proof of concept.

If it turns out it's called many times and speed is an issue, we can implement it in the backend in theory. However, first we should see if QEMU actually works with that function returning 0 all the time.

@atrosinenko
Copy link
Contributor Author

Thank you, I will test it.

@stale
Copy link

stale bot commented Dec 9, 2019

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.

@stale stale bot added the wontfix label Dec 9, 2019
@stale stale bot closed this as completed Dec 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants