-
Notifications
You must be signed in to change notification settings - Fork 66
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
Failure to link due to unsupported instruction Add64
#279
Comments
Add64
It is a missing relocation handling of R_RISCV_LO12_I with Add64 instruction. I'll post a fix. Thanks for reporting this @cmichi! |
Thanks for the quick reaction, @aman4150! It's really helpful for us to have such a quick turnaround cycle. |
In addition, add a test to verify the same. Fixes: paritytech#279 Signed-off-by: Aman <[email protected]>
In addition, add a test to verify the same. Fixes: paritytech#279 Signed-off-by: Aman <[email protected]>
In addition, add a test to verify the same. Fixes: paritytech#279 Signed-off-by: Aman <[email protected]>
In addition, add a test to verify the same. Fixes: #279 Signed-off-by: Aman <[email protected]>
@aman4150 The reproducer that I linked above still fails, the error now is I get the error locally when recompiling the Rust program + relinking it with the latest |
@aman4150 Did you see my message above? Should we reopen this issue or should I create a new one? |
Sorry, I missed the previous message.
I see, that's odd your destination register is zero. I'll reopen the issue and have a look at this tomorrow. |
@aman4150 Thanks! If you have suggestions for how to work around it that would also be cool. I found that downgrading to |
Hi @cmichi, I confirmed I can link the reproducer binary you've provided with the latest version of the linker. Also, it is unlikely that compiler would emit a zero destination register, because then there is no point of relocation. Could you please apply this patch and run it again? It will give us pointers where the linker fails:
|
You mean that you are not getting the error with I applied the patch above, but the output didn't change. I then found that the error is triggered here. When I apply your patch there I get:
|
@aman4150 It indeed works with the binary I put above for the original bug. Sorry about that, here's the one that fails for zero destination register: https://github.com/use-ink/polkavm/raw/9d705fd7b050b3ebeb2cf89ee9b1511ca1bbb08c/examples/trigger-bug/reproducer-zero-reg. |
This is the faulting instruction sequence:
It suggests the code is trying to load from invalid (0x0) address. Which sounds like a bug in the code. Could you please share the original code that generates this sequence? |
That's not a load from an invalid address; that's a load into the zero register, i.e. a dummy load. I've seen this before; some of LLVM's optimization passes sometimes rewrite the destination register to zero and leave it for some reason. See |
@aman4150 I guess the original code is not needed then? |
right, I misspoke, it's a load into the zero register, which didn't make sense to me. Thanks for confirming you've seen this before @koute @cmichi, this should fix the problem:
I'll post a PR in some time. |
See paritytech/polkavm#279 for more details.
See paritytech/polkavm#279 for more details.
paritytech/polkavm#279 has been fixed.
paritytech/polkavm#279 has been fixed.
* Use `paritytech/polkavm/master` again paritytech/polkavm#279 has been fixed. * Upgrade `contracts-verifiable` Docker image for 6.0.0-alpha * Implement new address derivation * Make `clippy` happy
I've got a Rust program that builds fine, but during
polkavm_linker::program_from_elf
I get this error:The respective program is built using
I tried different recent Rust versions, that didn't have an impact. It's the same with
polkavm
0.21 and the latestpolkavm/master
.I checked the origin of the error and it's due to an unimplemented
match
arm forAdd64
.I've put the binary here.
You'll get a panic when attempting to link it:
The program is complex, and breaking it down to a more easily digestible reproducer will be complex. So before doing it, I wanted to create this issue to see if it already gets you somewhere. Alternatively, I can also provide you with the project to build.
The text was updated successfully, but these errors were encountered: