Fix RhpCallCatchFunclet .text relocation on amd64. #111227
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
c8e4f2c changed asm implementation in
RhpThrowHwEx
on amd64 from a relative jump, usingjmp RhpThrowHwEx
to amov rax, RhpThrowHwEx
that is later jumped to usingjmp rax
.This introduce an
ADDR64
relocation record in the generated object file:000004EC ADDR64 00000000 00000000 2A RhpThrowHwEx
That will then be left as a relocation that needs to be fixed up by the loader:
Where the RVA 73000 is part of the .text section that is read, execute section.
Having relocations done to the .text section is however not supported on all Windows platform configurations leading to loader errors blocking use of nativeaot on these configurations.
This commit change the mov to a
lea
instruction using relative offset to calculate address ofRhpThrowHwEx
. That will end up with aREL32
relocation record in the generated object file:000004ED REL32 00000000 2A RhpThrowHwEx
Since this uses relative addressing it won't leave any relocation in the final image making sure the generated nativeaot image can be successfully loaded on Windows platforms configurations that prevents relocations to .text section.