<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 - Potential bug for merging COMDAT groups with LOCAL signature symbols"
   href="https://bugs.llvm.org/show_bug.cgi?id=43094">43094</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Potential bug for merging COMDAT groups with LOCAL signature symbols
          </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>normal
          </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>leonardchan@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, peter.smith@linaro.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=22415" name="attach_22415" title="reproducer.tar.gz">attachment 22415</a> <a href="attachment.cgi?id=22415&action=edit" title="reproducer.tar.gz">[details]</a></span>
reproducer.tar.gz

When a particular symbol table entry is used as the signature symbol for a
comdat group, does it matter if the symbol is LOCAL when comdats are merged?
That is, if the signature symbol for comdat group `A` is LOCAL, is that comdat
group different from another one that also contains a symbol `A`? My
understanding is that if `A` in the first group is a LOCAL symbol, then it
cannot represent the symbol for any other object file, and thus the comdat
groups are different.

Example:

```
$ cat tmp1.s
.section .text.foo,"axG",@progbits,foo,comdat
.local foo
foo:
$ cat tmp2.s
.section .text.foo,"axG",@progbits,foo,comdat
.global foo
foo:
$ cat tmp3.s
.globl _start
_start:
  jmp foo
$ clang tmp1.s -c
$ clang tmp2.s -c
$ clang tmp3.s -c
$ ld.lld tmp1.o tmp2.o tmp3.o
ld.lld: error: relocation refers to a symbol in a discarded section: foo
<span class="quote">>>> defined in tmp2.o
>>> section group signature: foo
>>> prevailing definition is in tmp1.o
>>> referenced by tmp3.o:(.text+0x1)</span >
$ ld.lld tmp2.o tmp1.o tmp3.o  # Works fine
```</pre>
        </div>
      </p>


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

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