Skip to content

Commit

Permalink
Clarify R_<CLS>_RELATIVE optimization wording
Browse files Browse the repository at this point in the history
The optimization is applied by the static linker, so we should reword
the sentence from that perspective. Thanks to @smithp35 for suggesting
the wording.
  • Loading branch information
smeenai committed Jan 31, 2024
1 parent cc782c4 commit c1a64c7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion aaelf64/aaelf64.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1738,7 +1738,7 @@ The need for copy relocations can be avoided if a compiler generates all code re

- Because the initial value of the place is not related to the ultimate target of a ``R_<CLS>_JUMP_SLOT`` relocation the addend ``A`` of such a REL-type relocation shall be zero rather than the initial content of the place. A platform ABI shall prescribe whether or not the ``r_addend`` field of such a RELA-type relocation is honored. (There may be security-related reasons not to do so).

``R_<CLS>_RELATIVE`` represents a relative adjustment to the place based on the load address of the object relative to its original link address. All symbols defined in the same segment will have the same relative adjustment. If ``S`` is the null symbol (ELF symbol index 0) then the adjustment is based on the segment defining the place. On systems where all segments are mapped contiguously the adjustment will be the same for each relocation, thus adjustment never needs to resolve the symbol. This relocation represents an optimization; it can be used to replace ``R_<CLS>_GLOB_DAT`` when the symbol resolves to the current dynamic shared object.
``R_<CLS>_RELATIVE`` represents a relative adjustment to the place based on the load address of the object relative to its original link address. All symbols defined in the same segment will have the same relative adjustment. If ``S`` is the null symbol (ELF symbol index 0) then the adjustment is based on the segment defining the place. On systems where all segments are mapped contiguously the adjustment will be the same for each relocation, thus adjustment never needs to resolve the symbol. This relocation represents an optimization; a static linker can use it to replace ``R_<CLS>_GLOB_DAT`` when the symbol is known at static link time to always resolve to the current link unit.

``R_<CLS>_IRELATIVE`` represents a dynamic selection of the place’s resolved value. The means by which this relocation is generated is platform specific, as are the conditions that must hold when resolving takes place.

Expand Down

0 comments on commit c1a64c7

Please sign in to comment.