This repository contains the LLVM Go bindings used by GoALLC. It intentionally targets the customized LLVM build maintained by the GoALLC project; a system-installed LLVM is not supported.
The binding always reads LLVM headers below ${SRCDIR}/llvm; dynamic linking
also reads the LLVM shared library there:
llvm/include/llvm-c
llvm/lib
llvm is not committed. The caller must create it as a symlink to an LLVM
payload with this layout. GoALLC's cmd/dist manages that symlink from its
-llvm-dir option, whose default is $GOROOT/llvm.
The LLVM API version and link mode are independent, mandatory build-tag axes:
llvm23selects the LLVM 23 API. A future LLVM 24 port will addllvm24without changing how the payload path or link mode is selected.dynamicllvmlinksllvm/lib/libLLVM; it is the GoALLC default.staticllvmlinks${SRCDIR}/libLLVMGoALLC.a. GoALLC'scmd/distassembles and caches this build artifact from the selected payload's normal LLVM component archives withllvm-configandllvm-ar.
For example:
go test -tags='llvm23 dynamicllvm' ./...
go test -tags='llvm23 staticllvm' ./...
The static command requires libLLVMGoALLC.a to have been assembled first.
The GoALLC toolchain does this automatically for -llvm-link=static.
The final link also consumes the system libraries reported by the selected
LLVM build. On Darwin, zstd is resolved with pkg-config libzstd; the
development package must be installed and discoverable through pkg-config.
Do not select multiple version tags or multiple link-mode tags in one build.
Automatic pull-request checks currently validate the binding source only. Full dynamic and static tests require the customized GoALLC LLVM payload and are validated as part of integration work. Once the project publishes prebuilt LLVM payloads, CI will download those artifacts and run both link modes without rebuilding LLVM from source.
These bindings originated in LLVM and remain licensed under the Apache License
2.0 with LLVM Exceptions. See LICENSE.txt.