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

    <tr>
        <th>Summary</th>
        <td>
            `UseInitArray` should not be consulted for non-elf binaries
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          keith
      </td>
    </tr>
</table>

<pre>
    Currently `AsmPrinter` reverses the list of ctors in the case that `UseInitArray` is `false` https://github.com/llvm/llvm-project/blob/bd570709c06a19637f3e8df47cb6f9a094fa6aa8/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp#L2713-L2716

This logic runs even for macho binaries where ctors vs init_array doesn't apply. It seems like this logic should be gated on some check around the binary actually supporting ctors vs init_array. I assume this is an issue for coff as well
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUkkFv5CgQhX8NvpTSwthtNwcfehP1KtIe9jBzHpWh3GaCwaJwR_3vR3iSTA65zAVESY969dVDZncNRIM4_iOOTxVueY5peCGX52qM9j48bilRyP4OopNnXv5PLmRKopOQ6EaJiSHPBN5xhjiByTExuLAXDTJBnjEX8Xem5-DyOSW8F7njUp3QM5XnnPPKojkLdRHqcnV53saDiYtQF-9v79fDmuJPMlmoy-jjWC577GUvtZEd1rpr-qmhk53a3ozdpFHqdsIO8fTpH1d0j9HSvxSEunya6vPjYNZVqOY_1dfNQzk7IZ-EPP8-v82OwcerM5C2wEA3CjDFBAuaOcLoAiZHDK8zJXqjcitgXP6BBQHYSByE6jPguvr7AZ4zMNHC4N1LwfbRgOe4eQsjwRUzWYgBOC4EZibzApjiFuzOe-96BzR5Q-_vwNu6xpRduH7l4ADPgMzb8tbMMWAAx7zRPomJ0wTI8EreV3ZorG40VjTUXS-PTd_XTTUPrdWmM2M9GrKmR5SndtKtNorakbTWlRuUVKpW8qRUfZT9AY1pR6tHNU266xorWkkLOn8o6znEdK12C8NRt7WsPI7k-T2fadhDMG5XFq0smeM_suyyp-GLpL3xCzEXhiYG3nzhWIYMMTyQnz4WVm3JD3-dxd0xC3XZTf8KAAD__wFIHd0">