Skip to content

Apple ARM64 Clang assembler fails to resolve symbolic constants in movk instructions #352

@WeGoToMars

Description

@WeGoToMars

Environment

  • OS: macOS (Apple Silicon)
  • Assembler: Apple clang version 17.0.0 (clang-1700.0.13.7, latest) with integrated assembler
  • Architecture: arm64

Issue Description

The Apple ARM64 assembler fails to handle symbolic constants (defined with .equ) when used with movk instructions. This affects the CRC32 implementation for ARM64 in files like crc/aarch64/crc32_gzip_refl_pmull.h.

The error manifests as: error: unexpected token in argument list

I was able to get it to build when I replaced all .equ statements with their literal values. Changing .equ to .set didn't resolve the issue.

p4_low_b0 → 0x2d95
p4_low_b1 → 0x8f35
p4_high_b0 → 0x13d7
p4_high_b1 → 0x1d95
p1_low_b0 → 0x9191
p1_low_b1 → 0xae68
p1_high_b0 → 0x009e
p1_high_b1 → 0xccaa
p0_low_b0 → 0x6765
p0_low_b1 → 0xb8bc
br_high_b0 → 0x1641
br_high_b1 → 0xf701
br_high_b2 → 0x1
br_low_b0 → 0x0641
br_low_b1 → 0xdb71
br_low_b2 → 0x1

I see that the gas is the only supported assembler, but this is the only change that prevents building with Clang, which is preinstalled with XCode on macOS.

Could the .equ statements be replaced with macros to fix this compatibility issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions