<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 --- - [LTO] Undefined symbols reported when linking old gas(1) on FreeBSD"
   href="https://llvm.org/bugs/show_bug.cgi?id=28218">28218</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[LTO] Undefined symbols reported when linking old gas(1) on FreeBSD
          </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>All Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>davide@freebsd.org
          </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>$ sh link.sh
undefined symbol: __libc_allocate_tls
undefined symbol: __malloc
undefined symbol: __calloc
undefined symbol: __realloc
undefined symbol: __free
undefined symbol: _thread_autoinit_dummy_decl_stub
undefined symbol: __clock_gettime
undefined symbol: __raise


$ nm -print-armap ./libc.a |grep __malloc
__malloc in jemalloc_jemalloc.o
[...]
                 U __malloc
---------------- T __malloc

The output of llvm-dis on jemalloc_jemalloc.o shows:

module asm ".weak malloc"
module asm ".equ malloc, __malloc"

; Function Attrs: nounwind sspstrong uwtable
define noalias i8* @__malloc(i64 %size) #0 {
entry:
  %tsdn = alloca %struct.tsdn_s*, align 8
  %usize = alloca i64, align 8
  %ut = alloca %struct.malloc_utrace_t, align 8
[...]

Repro coming (bugzilla doesn't like large attachments)</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>