Register only the LLVM targets this build can emit for, and build the bench on Windows - #17
Merged
dreamsailing59-ops merged 1 commit intoAug 22, 2026
Conversation
… bench on Windows main does not link against the official LLVM 20 Windows package. target.cpp calls InitializeAll*, which expands to every target the host LLVM was configured with; that package ships seven (AArch64 ARM X86 BPF WebAssembly RISCV NVPTX) while CMakeLists linked four, so the link fails with 14 unresolved LLVMInitialize* symbols for BPF, WebAssembly and NVPTX. Register x86-64 and AArch64 explicitly -- they are the only targets the emitter can produce -- and derive both the registration and the linked components from LLVM_TARGETS_TO_BUILD, so this also compiles against an LLVM built without one of them rather than trading a Windows break for a Linux one. Fails the configure with a clear message if neither target is present. benchmarks/llvm_backend_bench.c used clock_gettime/CLOCK_MONOTONIC, which MSVC does not provide, so the benchmark target never built on Windows. Adds a QueryPerformanceCounter path. Verified: 28/28 ctest on Windows (MSVC 19.50, LLVM 20.1.8) and on a Raspberry Pi 4 (GCC 14.2, LLVM 19, 21 targets built), which exercises both sides of the gating.
Contributor
|
if i have to review another PR i will explode and die |
Contributor
Author
|
do a flip! |
This was referenced Aug 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
maindoes not link against the official LLVM 20 Windows package.target.cppcallsInitializeAll*, which expands to every target the host LLVM was configured with. That package ships seven (AArch64 ARM X86 BPF WebAssembly RISCV NVPTX) whileCMakeLists.txtlinked four, so the link fails with 14 unresolvedLLVMInitialize*symbols for BPF, WebAssembly and NVPTX.Why this shape
Naming X86 and AArch64 unconditionally fixes Windows but breaks against an LLVM built without one of them — the call would not even compile. So both the registration and the linked component list are derived from
LLVM_TARGETS_TO_BUILD, whichLLVMConfig.cmakereports:with matching
#if defined(...)guards intarget.cpp, and aFATAL_ERRORif neither target is present.Also
benchmarks/llvm_backend_bench.cusedclock_gettime/CLOCK_MONOTONIC, which MSVC does not provide, so the benchmark target never built on Windows. Adds aQueryPerformanceCounterpath; the POSIX path is unchanged.Verification
Those two LLVM builds have very different target sets, which is what exercises the gating in both directions.