<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 --- - lld -Bstatic fails to link because _end is undefined"
href="https://llvm.org/bugs/show_bug.cgi?id=25528">25528</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>lld -Bstatic fails to link because _end is undefined
</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>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>The first bug found while building world on FreeBSD =)
sbrk() access _end (directly!) to understand where .bss ends.
The linker should probably insert that in the generated executable (at least
when -Bstatic is used). It seems gold doesn't strip the symbol even if not
referenced.
% ./clang sbrk.c -fuse-ld=lld2 -o sbrs -static
undefined symbol: _end in sbrk.o
clang-3.8: error: linker command failed with exit code 1 (use -v to see
invocation)
Linker invocation:
"/exps/llvm-lld/build/bin/./ld.lld2" -Bstatic -o sbrs /usr/lib/crt1.o
/usr/lib/crti.o /usr/lib/crtbeginT.o -L/usr/lib /tmp/sbrk-63b6db.o -lgcc
-lgcc_eh -lc -lgcc -lgcc_eh /usr/lib/crtend.o /usr/lib/crtn.o
% cat sbrk.c
#include <sys/types.h>
#include <unistd.h>
int
main(void)
{
void *me = sbrk(42);
return (0);
}</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>