<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/60659>60659</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            CYGWIN: cannot compile clang-shlib: "error: export ordinal too large"
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          carlo-bramini
      </td>
    </tr>
</table>

<pre>
    I tried to compile the latest 15.0.7 with CYGWIN and I got this error at the final stages of the process:

```
[ 96%] Linking CXX shared library ../../../../bin/cygclang-cpp-15.dll
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: error: export ordinal too large: 96680
collect2: error: ld returned 1 exit status
make[2]: *** [tools/clang/tools/clang-shlib/CMakeFiles/clang-cpp.dir/build.make:2072: bin/cygclang-cpp-15.dll] Error 1
make[1]: *** [CMakeFiles/Makefile2:43633: tools/clang/tools/clang-shlib/CMakeFiles/clang-cpp.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
```

I configured CMake in this way:

```
cmake -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" ../llvm
```

as it has been described in this page:

https://clang.llvm.org/get_started.html

Adding `LLVM_BUILD_LLVM_DYLIB=ON` didn't change the error message.
Using the solution described here:

https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-clang/0009-Use-hidden-visibility-when-building-for-MinGW-with-Clang.patch

didn't seem to help; GCC prints:

```
warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
```

which seems to be not effective for sorving the trouble.
Into the FAQ, I have not found a way for fixing this error.
Is there a solution to bypass the 64K limit of exported symbols from a DLL?

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVU1v2zgQ_TX0ZSBDoizZPvjgjyjw1km73WbTngKKGkncUKRAUnH87xek6sT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