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.
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
[lld][LoongArch] Support the R_LARCH_{ADD,SUB}_ULEB128 relocation types #81133
[lld][LoongArch] Support the R_LARCH_{ADD,SUB}_ULEB128 relocation types #81133
Changes from 2 commits
03866c8
f53db4f
d389797
7687cc3
c860d46
7793126
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
UINT64_MAX can be used for 32-bit as well.
Perhaps
count < maxcount ? (UINT64_C(1) << 7 * count) -1 : UINT64_MAX
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.
If
config->is64 == false
, we expectmask
is0x0000'0000'ffff'ffff
so that the results will not be broken by the high-32-bits. (In 32-bits ELF file the addr size is 32bits, so the content should not be overflowed.)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.
Are the relocations defined to be 32-bit on ELF32? It looks strange.
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.
And there is no test checking the 32-bit behavior
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 can add the same test as a.o for 32-bit.
uleb128(-1u) == 0x0f'ff'ff'ff'ff
. Assuming it reserved 5 bytes space and we executing SUB -1 on 32-bit first, then without this mask we might get 0x7f'ff'ff'ff'ff, which [35:33] is 1. These relocations is relocated address, and address should be limited in 32-bit on ELF32. So we need this mask to avoid breaking the high-space.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've checked x86, mips and riscv ELF32 by GUN AS, they all handle uleb128 as 64bits value. So it's my misunderstanding. I'll correct it.
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.
encodeULEB128((orig + val) & mask, loc, count);
to avoid changingval
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.
a.o since the filename is determined