Stream: git-wasmtime

Topic: wasmtime / PR #7184 riscv64: Add GOT relocations for PIC ...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 07 2023 at 23:07):

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 used RISCV_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.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 07 2023 at 23:07):

afonso360 requested fitzgen for a review on PR #7184.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 07 2023 at 23:07):

afonso360 requested wasmtime-compiler-reviewers for a review on PR #7184.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 07 2023 at 23:08):

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 used RISCV_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.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 09 2023 at 03:25):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 09 2023 at 04:38):

alexcrichton merged PR #7184.


Last updated: Dec 23 2024 at 12:05 UTC