<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - LLD fails to merge similarly named sections"
   href="https://bugs.llvm.org/show_bug.cgi?id=42289">42289</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LLD fails to merge similarly named sections
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>ELF
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>ndesaulniers@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, peter.smith@linaro.org, sedat.dilek@gmail.com, srhines@google.com
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>4068
          </td>
        </tr></table>
      <p>
        <div>
        <pre>via: <a href="https://github.com/ClangBuiltLinux/linux/issues/431">https://github.com/ClangBuiltLinux/linux/issues/431</a>

It seems that ld.bfd merges sections with the same name, whereas ld.lld does
not.

$ ld.bfd -r -o driver.ko ath10k_core.o ath10k_core.mod.o
$ readelf -S driver.ko | grep rodata\.cst32  [71] .rodata.cst32     PROGBITS   
     0000000000000000  00062d60

$  ld.lld -r -o driver.ko ath10k_core.o ath10k_core.mod.o
$ readelf -S driver.ko | grep rodata\.cst32
  [104] .rodata.cst32     PROGBITS         0000000000000000  00a20850
  [157] .rodata.cst32     PROGBITS         0000000000000000  00a20e20

This produces dmesg warnings for kernel modules linked with LLD:

$ dmesg | grep sysfs:
[    1.969125] sysfs: cannot create duplicate filename
'/module/i915/sections/.rodata.cst16'
[    3.954645] sysfs: cannot create duplicate filename
'/module/bluetooth/sections/.rodata.cst16'
[    4.009524] sysfs: cannot create duplicate filename
'/module/mac80211/sections/.rodata.cst32'
[    4.122455] sysfs: cannot create duplicate filename
'/module/ath10k_core/sections/.rodata.cst32'</pre>
        </div>
      </p>

        <div id="referenced">
          <hr style="border: 1px dashed #969696">
          <b>Referenced Bugs:</b>
          <ul>
              <li>
                [<a class="bz_bug_link 
          bz_status_CONFIRMED "
   title="CONFIRMED - [Meta] Compiling the Linux kernel with clang"
   href="https://bugs.llvm.org/show_bug.cgi?id=4068">Bug 4068</a>] [Meta] Compiling the Linux kernel with clang
              </li>
          </ul>
        </div>
        <br>

      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>