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

    <tr>
        <th>Summary</th>
        <td>
            lld will not emit separate data sections for data that ends up in `.sbss` or `.sdata` on RISC-V 
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    I am using lld with LTO, targeting `elf32lriscv`. The input to lld is LLVM bitcode. As expected each large global is placed in a new section, however `.sbss` and `.sdata` are used for all globals under the small data threshold, rather than creating a new `.sdata.global_var` or similar. This prevents `--gc-sections` from being able to eliminate unreferenced small global variables.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxUUs1u2zwQfBrqsrBAU7IcH3TIlw8GAqQo0Aa5FktyLbGgSIFLOc3bF6Tdv4MgkNydndkZZHZTIBrF4T9x-L_BLc8xjZrC-kGNjvZjfAZcYGMXJvDewrvLM7y8fhbqCTKmiXJ5EYMkf-mUT47NVQyyhdeZwIV1y5Bj7XQMLy9vn0C7bKKlFh4Z6MdKJpMFQjODL3gw-ajRl_LVoyELLgBCoHdgMtnFUEbP8Z2ulMrgljWzGCRgsLezxYz1IhFsTBYuMQF6f4dm2IKlBHkm4KXclwbIcyKeo7cFP2GeawkGMImwqryx-D2ivcF9u2Iq02ICdovzmIr4Qj_RlULm0rHbTWZ351_JXlJcQFOF1Z7Kksi7xQXMBFtIdKFEoci_Ubxv5YrJlXpuGzt29tSdsKFxP5ykPB2PB9nMY4_Hk9bakB6Qemtwf-z3e4OdNJ2i7qFxo5Kqk8fydYeDbB_oQZ8u0hqzH5DkXvSSFnS-9f66tDFNjWPeaBx62XeNR02ea2KUKgupj0KpEqA0lp6d3iYWvfSOM_9ByS57Gm8p8h5CzECLy8C0Yiq6qw-_tlRduzuDGShYhm0tafjb9Jj-9TwG-PL89Wn3Bs2W_DjnvLLoHoU6C3WeXJ433Zq4CHUutO6_3ZridzJZqHMVw0Kdq9ifAQAA__9a_QsD">