<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/137043>137043</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`lld-link` ignores section alignments greater than `/ALIGN`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
beetrees
</td>
</tr>
</table>
<pre>
The COFF object format supports section alignments up to 8192, whereas the default value of the `/ALIGN` command line argument (used as the alignment of all sections in the PE output) is 4096. If a section in a COFF object file has an alignment greater than the value of `/ALIGN` (such as in [this Rust example](https://github.com/rust-lang/rust/issues/70144#issuecomment-2825245012)), MSVC `link.exe` will exit with an [LNK1164 linker error](https://learn.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-error-lnk1164?view=msvc-170), whereas LLVM `lld-link` will ignore it and continue to use the smaller value of `/ALIGN` as the alignment of the sections in the PE output.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8U12vnDYQ_TXmZQSCMSzLAw-5e0sVdZNWbZV3AwO419jIH7u3_74yu9nmRjeRkMCD58w5M2eEc3LWRC2rnlj1nIjgF2PbnshbIpf0Zvy3_XshOP3edWD6f2jwMBm7Cg8ubJux3oGjwUujQSg565W0dxA28AaORYMMT3BdyJJw4BeCkSYRlIeLUIHATHuQHXKG3Yfzx18_s0MOg1lXoUdQUhMIO4cICgyPwdEId6BHtQgilPpKw4HU-4U_fgET_BY8wwakgzJvDhl8nEA8GEsN4q00qQgW4UB8IwdmS8KTBb-IG_SD_HfEGR5dGJZIUWpg1ZNfpIM_g_NAr2LdFLHqmeFx8X5zjH9g2DHsZumX0GeDWRl2NjifKqHn-zfDTjoXyDHs6rwoS4Z8D8QmkfYpHrHCssoLZNjszwk-_fXlFLkpqV8yeqXI7SqVAnqVHq7SL1Egq57On38rikMZO_1CFshaY9-jqEhYna1ysMaZyd-5kk5D5DVsWzzF5HQl58S80_XGqHSPxtOtRBqD7hZNlX6J1RnvLpKujD-v7jKkRZ3fZXz1zfn85dMuR41phHnIkbM2lkB6iHYZjPZSB4rWC472SblVKEX2hxN7z0x73o_MlCVjy8eGNyKhtqjLquQH5JgsLU4jH3Ok8XAccahLwft6EqKfhmashpwS2WKOVV4iLxrkFWacBNVDLkrBm0NdIitzWoVUmVKXNTN2TvZJtwWv85InSvSk3L6qiJqusP9liHFzbRuT0j7MjpW5ks67_2G89Ira7zp4a9676_vG8G87lgSr2p_4N9a8v9LNmrhV31r4LuXS4n8BAAD__zEedxI">