GCC linker error: export ordinal too large

Hi, community.

Recently I got next gcc linker error: export ordinal too large.

I met it on two separate PCs after merging with the latest sources from the repo.

What could be the reason and how to resolve it?

Output:

[2325/2656] Linking CXX shared library bin\libclang-cpp.dll

FAILED: bin/libclang-cpp.dll lib/libclang-cpp.dll.a

cmd.exe /C “cd . && D:\WORK\Utilities\MSYS2\mingw64\bin\c++.exe -Wa,-mbig-obj -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -fno-common -Woverloaded-virtual -fno-strict-aliasing -O2 -shared -o bin\libclang-cpp.dll -Wl,–out-implib,lib\libclang-cpp.dll.a -Wl,–major-image-version,0,–minor-image-version,0 @tools\clang\tools\clang-shlib\CMakeFiles\clang-cpp.rsp && cd .”

D:/WORK/Utilities/MSYS2/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/10.2.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: error: export ordinal too large: 66444

collect2.exe: error: ld returned 1 exit status

[2328/2656] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CIndex.cpp.obj

ninja: build stopped: subcommand failed.

I’m using next commands:

cmake -GNinja …/llvm -DLLVM_LIT_ARGS=-sv -DLLVM_ENABLE_PROJECTS=clang -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=…/…/install -DLLVM_ENABLE_ASSERTIONS=ON

ninja

PC 1: win10 intel

PC 2: win10 amd