afonso360 opened PR #7184 from afonso360:riscv-call-plt
to bytecodealliance:main
:
:wave: Hey,
This PR does a number of things:
Firstly we change all calls to use the
RISCV_CALL_PLT
relocation. The previously usedRISCV_CALL
relocation has been deprecated even for non PLT calls. Both relocations are defined as having the same behavior, but we might as well switch to the newer one.The second commit ensures that we only set the RVC eflag when we actually have the C extension enabled for the given TargetIsa. The C extension is no longer mandatory, so we should not be setting it unconditionally.
The third commit changes the
Call
instruction to unconditionally use PC relative calls. Previously we would use PC relative calls for normal function calls, and use an indirect call for libcalls. I'm not entirely sure why this was done this way. None of the other backends do this either.Finally in the last commit we add support for GOT relocations when compiling with the
is_pic
flag. These relocations are fairly similar to the scheme that is used for ELF TLS GD (#7003). We have a label, a relocation pointing to the symbol, and finally a relocation pointing back to the label.This turned out to touch a lot of different stuff, let me know if you'd like me to split it into multiple PR's.
afonso360 requested fitzgen for a review on PR #7184.
afonso360 requested wasmtime-compiler-reviewers for a review on PR #7184.
afonso360 edited PR #7184:
:wave: Hey,
This PR does a number of things:
Firstly we change all calls to use the
RISCV_CALL_PLT
relocation. The previously usedRISCV_CALL
relocation has been deprecated even for non PLT calls. Both relocations are defined as having the same behavior, but we might as well switch to the newer one.The second commit ensures that we only set the RVC eflag when we actually have the C extension enabled for the given TargetIsa. The C extension is no longer mandatory, so we should not be setting it unconditionally. This flag allows the linker to use compressed instructions when relaxing relocations.
The third commit changes the
Call
instruction to unconditionally use PC relative calls. Previously we would use PC relative calls for normal function calls, and use an indirect call for libcalls. I'm not entirely sure why this was done this way. None of the other backends do this either.Finally in the last commit we add support for GOT relocations when compiling with the
is_pic
flag. These relocations are fairly similar to the scheme that is used for ELF TLS GD (#7003). We have a label, a relocation pointing to the symbol, and finally a relocation pointing back to the label.This turned out to touch a lot of different stuff, let me know if you'd like me to split it into multiple PR's.
alexcrichton submitted PR review.
alexcrichton merged PR #7184.
Last updated: Nov 22 2024 at 16:03 UTC