so according this: GitHub - mstorsjo/llvm-mingw: An LLVM/Clang/LLD based mingw-w64 toolchain
- Libtool based projects fail to link with llvm-mingw if the project contains C++. (This often manifests with undefined symbols like
___chkstk_ms
,__alloca
or___divdi3
.) For such targets, libtool tries to detect which libraries to link by invoking the compiler with$CC -v
and picking up the libraries that are linked by default, and then invoking the linker driver with-nostdlib
and specifying the default libraries manually. In doing so, libtool fails to detect when clang is using compiler_rt instead of libgcc, because clang refers to it as an absolute path to a static library, instead of specifying a library path with-L
and linking the library with-l
. Clang is reluctant to changing this behaviour. A bug has been filed with libtool, but no fix has been committed, and as libtool files are shipped with the projects that use them (bundled within the configure script), one has to update the configure script in each project to avoid the issue. This can either be done by installing libtool, patching it and runningautoreconf -fi
in the project, or by manually applying the fix on the shippedconfigure
script. A patched version of libtool is shipped in MSYS2 at least.
the pre-built static library was configured to link with some other compiler_rt
version and it’s mismatching with the zig’s compiler_rt
?
these linking errors… it’s so hard to track down the root cause…
Edit:
Some observations:
is not exported?
___chkstk
was first introduced: Implement stack probes for x86/x86_64 · ziglang/zig@be7cacf · GitHub
but got removed in this pr, couldn’t find any specific comments on them:
compiler_rt: compile each unit separately for improved archiving · ziglang/zig@80790be · GitHub