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

    <tr>
        <th>Summary</th>
        <td>
            [lld] Workaround incorrect gcc -ggdb3 .debug_macros generation like mold just did
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          Romain-Geissler-1A
      </td>
    </tr>
</table>

<pre>
    Hi,

This issue relates to some others I had opened in the past, for a problem that seems to be in the end some incorrect .debug_macros generation by gcc when building with gcc -ggdb3.

See the historic of this issue in different projects:
 - https://bugs.llvm.org/show_bug.cgi?id=42030
 - which lead to this gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91239
 - and recently mold hit exactly the same issue: https://github.com/rui314/mold/issues/438

@[rui314](https://github.com/rui314) The author of mold decided to eventually workaround this in mold, depsite gcc having some debatable/wrong behavior, in this commit: https://github.com/rui314/mold/commit/8c5e4df741c2dde98e4dceee38e9844d9187f88a

Would it be possible to implement a similar workaround in lld so that binaries built with gcc -ggdb3 and linked with ld.lld don't end up in a huge memory/cpu hog in gdb ?

Cheers,
Romain
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVVMtu2zAQ_BrpsrAgk3IsHXRIE6TttQ2QY0CRK4kJJQokFTf9-i5pxzWCpmgBw-Jrd2eGs-ysem2_6IzdZOVtVl4f_-9H7UF7vyI4NCKgh2DB2wnBhhGdh68wCgV2wRkV6BloFRbhAyWC3joQsDjbGZxoRwTwiFPK0eHbaZzVMaOepXUOZYBCYbcOj5OQznoYKLcTQdsZulcYpITDiDRetVF6HuCgw5iWN8OgOl5cEviOmIoQj2CdlmB7mp9JEQSl-x4dziECfaLqPuOnYNjAGMKSFtgd_QiUL4x5mQrrBpr70R4eabGQg874nVYZv61Yyctz_GHUcgSDpBGRTpUjUoqhpO-y00YxzOspNx35qY0RH5Rptow35zKCNCTliIV5hckaRYQD4A8h40IUwIuocCT9h8Ik4NoV0k40cavm24oGMQ19UoynQcXrS2Wzqsx2n06nd7cZq_8haQP3hEWsYSRr0FUkqAqlVpgEwheisApDoA_WPQtnV2J2vLAZjohuKGDxOmBSchQv0QPJQOQaEQSZjSoenKXlDuO-dTEq2Y0SEaJJh_9U4RTE7mq5w0r1-2ormVLY1DSTiMhrGleVarb1vq9rcSnVg12JJl0ImX6x3muCGNnqaaHGiNYT4PWkjXCXtAmwMbE3jq3T6Vk4TR0YjR_euz5ZwOj5mYRMW0YVMVrZOWP7kLpsXWJOAeM6IEw4WfcaqS0rjHaIW5QIyGCX2G9GpDY_Pwvf7CT0nKuWq4Y3Ig86GGzJCFSLXAAPl_Df2vkC5YedbfQzHu3wtPpAXany1Zn2L1cU-_D02Zxa99Kuu13Jq3xs-b6TfcPxiveN5E25ZdVV1YhdX2ElrxTLjejQ-MiBCOS6ZSVjZcXYtizrXV0wtSvVVd9UNUcm1Z58j6SBOb8DuWsThvg40Kahl-b3I5ELuu5hRnzLf_R-e9Rx8xkJr0G32V7nCXmbYP8CBrDTVg">