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

    <tr>
        <th>Summary</th>
        <td>
            BOLT: BOLT generates invalid constant pool in .gdb-index
        </td>
    </tr>

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

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

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

<pre>
    I think that after this commit https://github.com/llvm/llvm-project/commit/dcfa2ab534c8f1b4345012a02f130a0a07060bfd, BOLT might generate invalid constant pool table, due to CU reordering taking place here:
https://github.com/llvm/llvm-project/blob/b16fe132c68834a601b29c0eb53c7ec25a3cd627/bolt/lib/Core/GDBIndex.cpp#L126-L132

If the reordering did indeed happen, then CU-indexes in the constant pool should be updated, otherwise they point to wrong CUs, right?

cc @ayermolo 
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUkstuNCcQhZ-G3pQ8gqJvs-iFPb86smQpm_gBuFR3EzPQAtqXt4-YiZVkkYVXJcE56NThUzm7NRBNrHti3a9GHWWLaXIlxcVd40ejo_2anqFsLrxB2VQBtRRK9SCDiderK7CVsmcmHxnODOfVle3QJxOvDGfv37_Hw57in2QKw_nuYzhbsyhUupOtGRehW9l2XKDiuAjJFVd84D3Xi2V4gaffX_6Aq1u3AisFSqoQuPCuvLNgYshFhQJ7jB6K0p6qxR4EJcLlFRLFZCm5sEJRb3XsXhmCjRLV5Pzxx0toH3Udol9ISDT9OMpW9VxoPBtOupNmIIOdksb2OFRp9NXoXfVdYiKG82-_np6Dpc-T2XeG8kVg__AiJDJeQz0vUDb6d3rrLLhgiSxsat8p1D3LRgEurw_14pMyuHCz_beVvMXDW9AEx25VoVupsWyUPlymaviCPbpQamUfKYYVLq-5ilItncn5nskYYC1XX5Su0Udo7CTtWZ5VQ5MYuhZRyH5otslojq0ZSZ7PqkW5GNEi8t7QaDXnnWnchBw7PnIpRIvtcLKLQalpHIZlOPetYC2nq3L-VJs_xbQ2LueDJtGJsReNV5p8vpGLWOlgiJXhNN1-Sh9rZi33Lpf8zwvFFU_TTS0f70x905T_BycX4LRafW-3OZKffszKLXdmOP8d_X3CvwIAAP__sjkfig">