Skip to content

Bad LLVM code generation on Aarch64 Darwin #39818

@Keno

Description

@Keno

LLVM generates the following code on AArch64 darwin under make debug:

        bl      _japi1_BitSet_5477
        str     x0, [x19, #224]
Lloh112385:
        adrp    x8, __MergedGlobals.2@PAGE
Lloh112386:
        add     x9, x8, __MergedGlobals.2@PAGEOFF
Lloh112387:
        adrp    x8, __MergedGlobals.5@PAGE
Lloh112388:
        add     x8, x8, __MergedGlobals.5@PAGEOFF
        stp     x8, x9, [x19, #24]
        adrp    xzr, __MergedGlobals.1@PAGE
        add     xzr, xzr, __MergedGlobals.1@PAGEOFF

The last statement here is invalid and actually encodes add sp, sp, __MergedGlobals.1@PAGEOFF, which corrupts the stack.

Metadata

Metadata

Assignees

No one assigned

    Labels

    system:apple siliconAffects Apple Silicon only (Darwin/ARM64) - e.g. M1 and other M-series chipssystem:macAffects only macOSupstreamThe issue is with an upstream dependency, e.g. LLVM

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions