Files
zig/cmake
Matthew Lugg 2ec50b7e3d cmake: remove duplicate Clang libraries
The list of Clang libraries to link against contained duplicates.
However, while it doesn't look like Andrew realised this when he
originally added these imports, there *was* a reason for them: they were
seemingly necessary to deal with GNU ld's ridiculous requirements
surrounding the order of static archives on the command line. (LLD does
not have this constraint, so it is relevant only when using GNU ld,
which under the modern bootstrap process only potentially occurs when
building zig2.)

This was causing issues when linking Zig against LLVM using Elf2,
because that linker currently includes all archives eagerly. (I expect
that it will always do this, but it should perhaps at least detect and
ignore duplicate archives in future.)

Luckily, it turns out there is a toplogical ordering for these
libraries, i.e. an order which they can be passed in which contains no
duplicates but also allows GNU ld to resolve all symbols.

FWIW, if in future we start running into link errors again because of
new dependencies between Clang/LLVM libraries, I'd probably prefer to
just wrap the libraries in `--start-group` and `--end-group` on the
linker command line if CMake has a way to do that... but hopefully we'll
be able to instead implement https://github.com/ziglang/zig/issues/16270
before we hit such a problem!
2026-05-26 06:30:28 +01:00
..
2026-04-25 21:49:39 +02:00
2026-04-25 21:49:39 +02:00
2024-05-15 15:37:12 +05:00