enhance dynamic linker to handle DT_RELR relocations #1345
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.
As this article
https://maskray.me/blog/2021-10-31-relative-relocations-and-relr explains, the relocations of new type RELR help significantly compress the traditional RELA ones.
More specifically, the new RELR section encodes information about relocations that merely need adding the base of the ELF object to a relative offset. The even entry encodes the location of the 1st symbol to be relocated. And the odd one encodes information about the subsequent symbols using a bitmap. For details look at the comments in the code.
The implementation is loosely based on the Musl one - https://git.musl-libc.org/cgit/musl/commit/?id=d32dadd60efb9d3b255351a3b532f8e4c3dd0db1
Fixes #1323