-
Notifications
You must be signed in to change notification settings - Fork 240
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
Linker relaxation ignores .option norvc #84
Comments
I ended up filing this here rather than say binutils, because this feels like a specification oversight for me, rather than a problem with any particular assembler. It seems that the assembler is generating code/relaxation correctly as specified. Both binutils and llvm-as seems to behave this way. |
That's nice. I hadn't noticed the pull request to psABI before, but it does seem that it would fix this for good. |
This is critically important for cases of building jump or vector tables on 4-byte boundaries, where each table element must be the full (uncompressed) form of a 'j' instruction. |
For the jump table case, you can also use .balign 4 on every entry. It’s annoying but is functionally correct. |
@psherman42 My understanding is that if you also have |
Currently, even if
.option norvc
is in effect, the assembler still generates relaxable instructions andR_RISCV_RELAX
relocations, which may end up getting turned into compressed instructions by the linker anyway:If we assemble and link it:
The generated relaxations can be seen in the intermediate object file:
I'm not sure how big of a deal this is. It is certainly unexpected at first glance, but it this even worth doing anything about?
I'm also not sure whether to post it here or post it at https://github.com/riscv-non-isa/riscv-elf-psabi-doc (where linker relaxation is specified), but my idea is that this kind of temporary
.option norvc
is probably rare enough that this case might not be worth the trouble getting the linker to handle this.The text was updated successfully, but these errors were encountered: