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

    <tr>
        <th>Summary</th>
        <td>
            Handle or reject multiple SHT_SYMTAB sections
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            tools:llvm-objcopy/strip
      </td>
    </tr>

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

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

<pre>
    According to the ELF gABI, "Currently, an object file may have only one section of each type [SHT_SYMTAB and SHT_DYNSYM], but this restriction may be relaxed in the future.". llvm-objcopy treats the last SHT_SYMTAB in an ELF object as the official symbol table, and ignores all the others. The others are not populated with symbols in memory, which means that `SymbolTableSection::removeSymbols` crashes (it assumes that there is at least one symbol - the null symbol - in the table, which is not the case as the symbol table hasn't been populated).

To fix this, we should either add proper support for multiple SHT_SYMTAB sections, or we should simply emit an error if more than one such section is encountered. For now, the error is probably simpler.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8kz9v4zgQxT8N1QwiSJQlOYUKZ3PGHnB7jd2kOpDUyGRAcQT-SVbf_kDJl7i6xjbNwW_ee5wRIZibQxxY-8La10KkqMkP77pv-qqQNK7DSSnyo3E3iARRI_zx1xlup5c_Gf8BjPMfyXt00a75LByQfEcVYTIWYRYraPGBQM6uQA4hoIqGHNAEKJSGuC4IrH25_Lz-c3n7dT29gHAj5OPr29-Xt1-sfc1gmSJEbQJ4DNGbHZLxEsGjFb9xBOM2fVOKyWPJOC_B2o_5ieS7omWF6FHEsNVYESI89DQuS8_O7vLFXkfTZJQRFsI6S7IQhbS4Gx3B3Bx5DCCs3YujRh9KuH79BuERHEVYaElWRBzh00R9p4XcdsaZ_JbdpzZKw4zC5d4iAuuqy1Z4zV0ve3KsObHm5HGmD9xvA-sqUF4EjQEYP5qsPqQZ75isBMEEEBEsZuPbQ-yGnjblLln7_c89xy-vuzATNif5RomA_yX0GAxoERzjfQSJ6L5NM_5csuqVVaf980owmd_be258hKAp2RHQZLEgxhEWTwt6CGlZyEeYyMOcbDSLxceHu8_TxiH_gApmXuwKOOc4HKD35MFMMJPHnIvbU0hKf82kCYBOUXIRPY4lnMmDo8-Mzk7viJClSSHtuvdAXxbj0IzPzbMocKi7vuVddWjqQg9dJzuBTa-qZmpxrDrZ1117xF7WnVBtW5iBV7ypeFXXh6qv67KvlRR4VFV9nMZKcXaocBbGlnmSS_K3woSQcOiqw-FYWCHRhm15OY-UZ6E5Pc484-e8LgvjPK-3H7ZLmW6BHSprQgzf4GiixeGncKPFnKXHbRP-L_UieTvoGJfcl_Ez4-ebiTrJUtHM-Dmz719Pi6fMY_y8OQiMnzcT_wYAAP__1jiJ1w">