diff options
| author | Maksim Panchenko <maks@fb.com> | 2025-03-18 14:31:31 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-18 14:31:31 -0700 |
| commit | 70bf5e514b21b34b01fb572428f8fbdf267d5c3b (patch) | |
| tree | 7dba84b34a495490bc460427533d4fb3bb82acc1 /offload/include | |
| parent | bc646f4b302339717e363efa3e57ec3468d190aa (diff) | |
[BOLT][AArch64] Symbolize ADRP after relaxation (#131414)
When the linker relaxes a GOT load, it changes ADRP+LDR instruction pair
into ADRP+ADD. It is relatively straightforward to detect and symbolize
the second instruction in the disassembler. However, it is not always
possible to properly symbolize the ADRP instruction without looking at
the second instruction. Hence, we have the FixRelaxationPass that adjust
the operand of ADRP by looking at the corresponding ADD.
This PR tries to properly symbolize ADRP earlier in the pipeline, i.e.
in AArch64MCSymbolizer. This change makes it easier to adjust the
instruction once we add AArch64 support in `scanExternalRefs()`.
Additionally, we get a benefit of looking at proper operands while
observing the function state prior to running FixRelaxationPass.
To disambiguate the operand of ADRP that has a GOT relocation against
it, we look at the contents/value of the operand. If it contains an
address of a page that is valid for GOT, we assume that the operand
wasn't modified by the linker and leave it up to FixRelaxationPass to do
a proper adjustment. If the page referenced by ADRP cannot point to GOT,
then it's an indication that the linker has modified the operand and we
substitute the operand with a non-GOT reference to the symbol.
Diffstat (limited to 'offload/include')
0 files changed, 0 insertions, 0 deletions
