Clang with the MSVC API can't link DLLs with WINDOWS_EXPORT_ALL_SYMBOLS
This can be reproduced with clang-cl and cmake (any version that supports it), and also with clang/clang++ with the changes in !3527.
clang with lto builds static libraries, executables, and shared libraries without
WINDOWS_EXPORT_ALL_SYMBOLS results in cmake additionally invoking its own
bindexplib, which tries to parse the object file... and fails similarly to the MSVC linker, as it can only handle the MS normal and bigobj formats.
A simple test is:
cmake_minimum_required(VERSION 3.10) project(simple-test) add_library(foo SHARED foo.cpp) set_property(TARGET foo PROPERTY INTERPROCEDURAL_OPTIMIZATION ON) set_property(TARGET foo PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS ON)
foo.cpp can be anything, as long as it successfully compiles into an object file.
Build this with:
set CC=clang-cl set CXX=clang-cl cmake -GNinja -DCMAKE_LINKER=lld-link ninja
And the linker command will fail with
unrecognized file format in 'CMakeFiles\foo.dir\foo.cpp.obj', generated by
cmake -E __create_def