Skip to content

LLVM backend fails to emit on macOS: ELF section name rejected by Mach-O writer #25

Description

@dougchansan

The LLVM backend cannot generate a module on macOS (Apple Silicon, arm64) at 1bec355. Generation dies partway through chunk emission:

LLVM ERROR: Global variable 'fix_pair_nan_f64' has an invalid section specifier
'.text.unlikely.fix_pair_nan_f64': mach-o section specifier requires a segment and
section separated by a comma.

Reproduced building Luigi's Mansion (GLME01); it failed at chunk 57 of 4164.

markColdFixup() in src/backend/llvm/fp_fixups.cpp:21 sets an ELF-style section name unconditionally. Mach-O requires __SEGMENT,__section form, so any .text.unlikely.* name is rejected outright by the Mach-O writer.

Skipping the cold-section hint when the target object format is Mach-O let all 4164 chunks generate successfully, and the resulting module ran clean (Luigi's Mansion, foyer.sav, median 81.2 fps against 79.1 for the C backend on the same machine). Gating the hint on the target format, or emitting a Mach-O-shaped section name instead, would both work; I did not send a patch because the choice between those is yours.

Toolchain: clang/LLVM 20 (llvm@20 from Homebrew), Release, Ninja, DOLRECOMP_ENABLE_LLVM=ON, host aarch64-apple-darwin.

Separately, and probably worth its own look: the C backend at this commit emits calls to ppc_fp_available_inline, which does not exist in the ModernGekko GXRuntime checkout we build against (vendor/dolphin/GXRuntime/include/core/cpu.h declares only ppc_fp_available), so a same-commit C module could not be built there to compare against.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions