Install llvm on macos.

This commit is contained in:
Alejandro Cabeza Romero 2026-05-21 13:10:33 +02:00
parent 61ff6d1be7
commit 5fcaa2916a
No known key found for this signature in database
GPG Key ID: DA3D14AE478030FD
3 changed files with 9 additions and 2 deletions

View File

@ -104,10 +104,12 @@ runs:
if [ "$OS" = "macos" ]; then SED_I="sed -i ''"; fi
$SED_I ':a;N;$!ba;s/\n}\n\n*$/\n return 0;\n}/' "${CIRCUIT_CPP_PATH}/main.cpp"
- name: Set up LLVM tools (macOS)
- name: Install llvm-objcopy (macOS)
if: ${{ inputs.os == 'macos' }}
shell: bash
run: echo "$(brew --prefix llvm)/bin" >> "$GITHUB_PATH"
run: |
brew install llvm
echo "$(brew --prefix llvm)/bin" >> "$GITHUB_PATH"
# TODO: Instead of insertion, make a fork that includes the appropriate patch (or the actual fix)
- name: Patch MacOS GMP

View File

@ -59,6 +59,8 @@ windows-lib: $(LIB)
# section" errors that GNU objcopy causes. On Windows/COFF: GNU objcopy suffices
# because COFF COMDAT is per-section (not group-based) and is already deduplicated
# automatically by the linker — the ELF GRP_COMDAT problem does not apply.
# On macOS/Mach-O: llvm-objcopy (from brew install llvm) is used — it supports
# --keep-global-symbol for Mach-O since LLVM 12.
PUBLIC_SYMS := $(PROJECT)_generate_witness $(PROJECT)_generate_witness_from_files
LOCAL_OBJ := $(PROJECT)_local.o
OBJCOPY := $(if $(filter windows,$(OS)),objcopy,llvm-objcopy)

View File

@ -77,6 +77,9 @@ regular non-COMDAT sections that are simply kept as-is rather than deduplicated.
`fr.o` is excluded from the merge because it contains only field arithmetic (`Fr_*`) with no circuit-specific calls.
It is safe to deduplicate across circuits — the linker picks one copy, which is correct since the code is identical.
On macOS/Mach-O, `llvm-objcopy` (from `brew install llvm`) is used — it supports `--keep-global-symbol` for
Mach-O since LLVM 12. It is not available in Xcode's toolchain and must be installed separately.
On Windows, GNU `objcopy` (from MinGW binutils) is used instead of `llvm-objcopy`. `llvm-objcopy --keep-global-symbol`
is not supported for COFF objects, but GNU `objcopy --keep-global-symbol` works correctly on COFF — it maps the local
binding to COFF storage class `C_STAT`. The ELF `GRP_COMDAT` problem that required `llvm-objcopy` on Linux does not