<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] - Relocatable output incorrectly handles __tls_get_addr"
   href="https://llvm.org/bugs/show_bug.cgi?id=30984">30984</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[ELF] - Relocatable output incorrectly handles __tls_get_addr
          </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>cad/iverilog fails to link under FreeBSD with next error:

/usr/bin/ld: error: relocation R_X86_64_PLT32 cannot refer to absolute symbol
__tls_get_addr

Seems we have a problem with -r.
getp.o file has:
9: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __tls_get_addr

After running -r LLD converts it to hidden absolute:
root@freebsd:/usr/ports/cad/iverilog # ld -r -o test getp.o
root@freebsd:/usr/ports/cad/iverilog # readelf -s test
Symbol table '.symtab' contains 11 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
...
     8: 0000000000000000     0 NOTYPE  GLOBAL HIDDEN  ABS __tls_get_addr

ld.bfd in the same sutuation leaves it as is:
root@freebsd:/usr/ports/cad/iverilog # ld.bfd -r -o test getp.o 
root@freebsd:/usr/ports/cad/iverilog # readelf -s test
Symbol table '.symtab' contains 16 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
...
    11: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __tls_get_addr

I am going to fix that.</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>