[AAELF64] Simplify expressions used for relative relocations #337
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.
The function Delta(S) returns the current binary's load bias (for the null symbol as well as for locally-defined S), and is only used in the definition of RELATIVE family relocations, which are not expected to have a non-null symbol operand.
Theoretically, a non-null symbol operand could be used to refer to a symbol in another binary, which would then cause Delta(S) to evaluate to the load bias of that binary. But I am unaware of any dynamic loader implementing this (checked glibc/musl/bionic/FreeBSD/NetBSD/OpenBSD), and its utility seems limited.
The description of R__RELATIVE appears to contemplate a different case in which different segments in the same binary have different load biases. It is unclear to me how this would work in practice. If the idea is to accommodate individual segments being loaded at independent addresses, I don't think this would be enough; ELF is not generally designed to accommodate this so numerous other changes to relocation processing would need to be made in order for this to work.
Therefore, simplify the definition of Delta as well as the users, and bring it in line with existing practice, by removing the argument and having it always produce the current binary's load bias, and adjust the R__RELATIVE description to match.