-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Clean up JIT<->EE relocations #121920
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
base: main
Are you sure you want to change the base?
Clean up JIT<->EE relocations #121920
Conversation
Introduce a `CorInfoReloc` enum and use it exclusively to communicate relocation types between the EE and JIT. Translate it in crossgen2/ILC to the file-format relocation type when necessary.
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
|
LGTM |
|
@jakobbotsch, I added a smoke test in #121895 to see whether or not it works on community platforms. I tried merging this PR branch and commenting out without your PR, the error/callstack is same as: #121878 (comment). |
|
That looks like #121871. It needs a separate change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 35 out of 35 changed files in this pull request and generated no comments.
|
PTAL @dotnet/jit-contrib @jkotas |
| return (RelocType)fRelocType; | ||
| } | ||
| } | ||
| // Translates relocation type constants used by JIT to RelocType enumeration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to use the CorInfoReloc enumeration inside the ObjectWriter too?
I see the ObjectWriter (the reloc handling in particular) as tightly coupled with the JIT. I am not sure whether we need two nearly identical enums and mapping between them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe? I do count a significant number of relocation types that the object writer has that the JIT never uses for its code and that we would not want to care about outside ObjectWriter (in the VM or superpmi particularly).
I suppose we could define those in the managed copy of CorInfoReloc specifically, next to the existing fake relocations that RelocType defines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMAGE_REL_BASED_... constants make it look like that these constants came from Windows SDK, but that's not actually true except ~3 of them. It is a left-over from fragile NGen that a lot of unrelated stuff got added to over time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do count a significant number of relocation types that the object writer has that the JIT never uses
I see SYMBOL_SIZE, FILE_ABSOLUTE, FILE_CHECKSUM_CALLBACK. Anything else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although seems like some of them can be deleted. These are the ones that the JIT does not use:
IMAGE_REL_BASED_ABSOLUTE
IMAGE_REL_BASED_ADDR32NB
IMAGE_REL_BASED_RELPTR32
IMAGE_REL_SECTION
IMAGE_REL_BASED_ARM64_PAGEOFFSET_12L
IMAGE_REL_TPOFF (looks unused)
IMAGE_REL_AARCH64_TLSLE_ADD_TPREL_HI12 (looks unused)
IMAGE_REL_AARCH64_TLSLE_ADD_TPREL_LO12_NC (looks unused)
IMAGE_REL_ARM_PREL31
IMAGE_REL_ARM_JUMP24
IMAGE_REL_SYMBOL_SIZE
IMAGE_REL_FILE_ABSOLUTE
IMAGE_REL_FILE_CHECKSUM_CALLBACK
For example, we could define these starting at 0x1000 in the managed view of the enum.
jkotas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. The additional cleanup can be done in separate PR
Introduce a
CorInfoRelocenum and use it exclusively to communicate relocation types between the EE and JIT. Translate it in crossgen2/ILC to the file-format relocation type when necessary.Fix #121878