<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - [ELF] - duplicate symbol error when linking some FreeBSD ports."
   href="https://llvm.org/bugs/show_bug.cgi?id=31354">31354</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[ELF] - duplicate symbol error when linking some FreeBSD ports.
          </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>Windows NT
          </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>grimar@accesssoftek.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=17749" name="attach_17749" title="repro">attachment 17749</a> <a href="attachment.cgi?id=17749&action=edit" title="repro">[details]</a></span>
repro

Noticed that when linked ports/sysutils/safecat-1.13
and I think I saw the same in few other ports.

Error was:
/usr/bin/ld: error: byte_copy.c:(.text+0x0): duplicate symbol 'byte_copy'
/usr/bin/ld: error: byte_copy.c:(function byte_copy): previous definition was
here

Reproduce file (attached) can be reduced to:
-o safecat
usr/ports/sysutils/safecat/work/safecat-1.13/str.a
usr/ports/sysutils/safecat/work/safecat-1.13/alloc_re.o
usr/ports/sysutils/safecat/work/safecat-1.13/byte_copy.o

and problem is that str.a contains byte_copy.o:
./makelib str.a str_len.o byte_chr.o byte_diff.o  byte_copy.o byte_cr.o
byte_zero.o

and has next symbol: 'byte_copy'

So LLD first creates lazy symbol 'byte_copy', then finds undefined 'byte_copy'
in alloc_re.o and resolves it. At the end it reports duplicate symbol from
byte_copy.o.

Do we want to fix it ?</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>