<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 - PPC32: executables linked with LLD gives segfault at _start on FreeBSD"
href="https://bugs.llvm.org/show_bug.cgi?id=43116">43116</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>PPC32: executables linked with LLD gives segfault at _start 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>Other
</td>
</tr>
<tr>
<th>OS</th>
<td>FreeBSD
</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>alfredo.junior@eldorado.org.br
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, peter.smith@linaro.org
</td>
</tr></table>
<p>
<div>
<pre>On FreeBSD13/powerpc64, I'm trying to compile and run powerpc32 binaries, but
they fail with segmentation fault at section "_start".
The test program is pretty simple:
int main() {
return 0;
}
The FreeBSD 32 bit compatibility libraries where linked using BFD and
applications compiled with CLANG9+BFD run fine on this system. The problem
appears when CLANG9+LLD9 is used.
Output on gdb:
Program received signal SIGSEGV, Segmentation fault.
0x39600000 in ?? ()
(gdb) bt
#0 0x39600000 in ?? ()
#1 0x100100b4 in _start (argc=1, argv=<optimized out>, env=<optimized out>,
obj=<optimized out>, cleanup=0x5003d254 <gethints+584>,
ps_strings=0x0) at /root/freebsd/lib/csu/powerpc/crt1.c:87
Following instruction by instruction execution on GDB, the crash occurs when
executing <_start+176>, with the following message:
Program received signal SIGSEGV, Segmentation fault.
0x39600000 in ?? ()
Cannot access memory at address 0x39600000
...
...
0x10010074 <_start+116> beq 0x10010084 <_start+132>
0x10010078 <_start+120> cmplwi r6,0
0x1001007c <_start+124> bne 0x10010068 <_start+104>
0x10010080 <_start+128> b 0x1001008c <_start+140>
0x10010084 <_start+132> stw r4,0(r3)
0x10010088 <_start+136> b 0x10010068 <_start+104>
0x1001008c <_start+140> cmplwi r8,0
0x10010090 <_start+144> beq 0x1001009c <_start+156>
0x10010094 <_start+148> lis r3,4099
0x10010098 <_start+152> stw r8,24(r3)
0x1001009c <_start+156> lis r3,4098
0x100100a0 <_start+160> addi r3,r3,20
0x100100a4 <_start+164> cmplwi r3,0
0x100100a8 <_start+168> beq 0x100100b8 <_start+184>
0x100100ac <_start+172> mr r3,r7
0x100100b0 <_start+176> bl 0x100103a8 <00000000.plt_call32.atexit>
...
...</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>