-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Labels
system:apple siliconAffects Apple Silicon only (Darwin/ARM64) - e.g. M1 and other M-series chipsAffects Apple Silicon only (Darwin/ARM64) - e.g. M1 and other M-series chipssystem:macAffects only macOSAffects only macOSupstreamThe issue is with an upstream dependency, e.g. LLVMThe issue is with an upstream dependency, e.g. LLVM
Description
LLVM emits the following:
Lloh1699:
adrp x8, __MergedGlobals.1@PAGE
Lloh1700:
add x9, x8, __MergedGlobals.1@PAGEOFF
Ltmp3214:
.loc 2 87 0
add x8, x22, #1
Ltmp3215:
.loc 14 197 0
ldr x10, [x21, #8]
Ltmp3216:
.loc 2 444 0
Lloh1701:
ldr x9, [x9]
LOH is what's called Linker-optimization-hint
which is an aarch64-specific thing where the linker patches out some instructions (an explanation of how that works is here: https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/AArch64/AArch64CollectLOH.cpp). However, after linking the instruction sequence is:
0x108017f4c <+1004>: adrp x8, 23520
0x108017f50 <+1008>: nop
0x108017f54 <+1012>: add x8, x22, #0x1 ; =0x1
0x108017f58 <+1016>: ldr x10, [x21, #0x8]
-> 0x108017f5c <+1020>: ldr x9, [x8, #0x740]
looks to me like what happened here is that the relocation offset overflowed the size of the available immediate operand of the subsequent load, causing it to overflow into the source register field, causing crashes.
Metadata
Metadata
Assignees
Labels
system:apple siliconAffects Apple Silicon only (Darwin/ARM64) - e.g. M1 and other M-series chipsAffects Apple Silicon only (Darwin/ARM64) - e.g. M1 and other M-series chipssystem:macAffects only macOSAffects only macOSupstreamThe issue is with an upstream dependency, e.g. LLVMThe issue is with an upstream dependency, e.g. LLVM