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

    <tr>
        <th>Summary</th>
        <td>
            LLD reports section type mismatches for synthetic sections that will not actually be synthesized
        </td>
    </tr>

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

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

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

<pre>
    We've observed that due to a phase ordering issue in LLD, a wildcard that places sections of different types together will produce a link error, even if 
% head /tmp/foo.s                                                  
.text 
nop 
% clang -c foo.s 
% head /tmp/foo.ld 
SECTIONS { 
  .text : { *(.text) } 
 
  .orphans : { INPUT_SECTION_FLAGS(SHF_ALLOC) *(*) } 
  ASSERT(SIZEOF(.orphans) == 0, "no orphans allowed")                           

% ld.lld -o foo -T foo.ld foo.o                                    
ld.lld: error: section type mismatch for .rela.plt                              
>>> <internal>:(.rela.plt): SHT_RELA 
>>> output section .orphans: SHT_PROGBITS 
[Exit 1] 
frobtop 1324 % ld.bfd -o foo -T foo.ld foo.o 
frobtop 1325 %  
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVF-PozYQ_zTmZRQEBo7kgYfsJtytFN2eNqkq9WVl7CG4NRjZQ-7ST1_hkN1W1z_XKIqj4ffH_o0Z4b0-D4gVKx5YsYvERJ11VX_1hO7aC-qixqpr9TMyXl4QbOPRXVABdYJATQhkQcDYCY9gnUKnhzNo7ycEPcDhsGP8EQR81UZJ4RbeaIREDx4laTt4sC0o3bbocCCg64geyJ6ROnQz08DorJokggCjh98AnbNuFsYLDqBbYMmOJVvGC-hQKGC8pn5kvG6tjT38789NLib8Rsv_wY5_MpFGDGdYSbjp_5u7Ucvj4_7x9PT8-QisfFhKAItFtr1V-ZbxdagxvgFW7u7AN7x1YycG_0Z5-vzlp9Prov1aH7Yfj4yvj5_q1-3h8PwYZIJq-P2LJmyPx_3LaYY__bJ_rmfrRT4gsx3LdpDMMTPOBwt3b2GM_YqKcT7j_ivFd8c5IKNiYxSs7BwdrE6wZDQv9sdbc5OZQ7hdhWx7v0zh-kCvfS9IdtBaB7FDI-LR0I8os2x_-wLLHvVA6AZhQiX05i7F-GY2PX46vb7sD9vvyHaicaK3Tb0Fu3C-vDx_fHg6He-84mH_TROkrLiH1TrbkB0hzXgOS3JN-4_JfUcqAgkiVWVqk21EhFVaZmlepB-yPOoqmeTFWmxKVWJaros8_YBJkpdNo9ZcylZGuuIJz9M05ZznZZrHa9HkmMgkF2KNbZuxPMFeaBMbc-lj685ReO2rNC02RRYZ0aDxYa5wPjeL83nAuGqGr5rp7FmeGO3JvwuQJoPV4bADh6N15P--q-hDX_11oA5Jy_dBEqZLmBiDJRCSJmHMFRpcwF7_jiqanKk6otGHptaM12dN3dTE0vaM1_N2lmU1OvsrSmK8DofzjNfL-S4V_yMAAP__Zv2EsQ">