<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/75451>75451</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
lld option for discarding the export table
</td>
</tr>
<tr>
<th>Labels</th>
<td>
lld
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Kha
</td>
</tr>
</table>
<pre>
Export tables are problematic on Windows as there is a hard limit of 2^16 exported symbols and surpassing that limit is a hard error even when linking executables, which rarely make use of the table. Thus, if we are in a situation like a language build system where we want to build object files suitable for both dll and exe linking, the only option available today seems to be to compile two versions of each object file, with and without exported symbols. It would be much nicer and more resource efficient if at *link* time we could decide to discard the export table for executables in order to avoid the symbol limit without having to recompile object files.
I'm mainly interested in the lld for MinGW use case but I assume such an option would be interesting for the lld-link.exe interface as well, and possibly other operating systems. I also saw that there might be a workaround by defining an (almost?) empty `.edata` section that convinces lld to discard its export table, but that would still generate a warning: https://github.com/llvm/llvm-project/blob/3e8b175eec6fef1a073fb7d0d867fbc6a7837f57/lld/COFF/Writer.cpp#L1224-L1228
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVM2O4zYMfhrlQmxgy06cHHyY7m6KQVv0UmDOtETH7MiSIcnJ5O0LKkl3Fj314gS2-PH7IYUp8dkT9Wr3i9p92-CapxD73ybcDMHe-u8fS4gZMg6OEmAkWGIYHM2Y2UDw8MbehmsCTJAnigScAGHCaMHxzBnCCFrtvtd7oIJFFtJtHoJLgN5CWuMiJPwZ8oT5UfQDhGIMEehCHq4TeXDs3-UwfZBZ77SU_grXic0EESO5G8z4TrAmkt55ojv7Lfw1reUsj3ClooU9ICTOK2YOgv1OgODQn1c8EwwrO2GbMs3SPZIUXtFnyOHxNQx_k8kwsviTVi69YAwRhpAnsM4VmfRBT-pCQVgF724QltIZL8iuVOZg8QaJaE6libwBE-aF5eM1wIVi4uCTiCM002cGxQnOU2kpf8Ka_2P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