<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 - [PowerPC64] [ELFv2] wrong .init section for large binaries (long branch thunk)"
href="https://bugs.llvm.org/show_bug.cgi?id=40740">40740</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[PowerPC64] [ELFv2] wrong .init section for large binaries (long branch thunk)
</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>A large powerpc64 ELFv2 executable linked with lld (i.e. clang) may have an
incorrect .init section and it will crash with SIGTRAP.
In the example bellow, where I'd expect "bl nnnnn <frame_dummy+0x8>", there's
a "trap" instruction instead, followed by function
"<__long_branch_frame_dummy>":
[root@alfredo-1 /home/alfredo.junior/tmp]# /usr/local/bin/objdump clang -d -j
.init
clang: file format elf64-powerpc-freebsd
Disassembly of section .init:
0000000013ca9f10 <_init>:
13ca9f10: 3c 4c 00 1d addis r2,r12,29
13ca9f14: 38 42 76 38 addi r2,r2,30264
13ca9f18: f8 21 ff d1 stdu r1,-48(r1)
13ca9f1c: 7c 08 02 a6 mflr r0
13ca9f20: f8 01 00 40 std r0,64(r1)
13ca9f24: 7f e0 00 08 trap
0000000013ca9f28 <__long_branch_frame_dummy>:
13ca9f28: 3d 82 ff e4 addis r12,r2,-28
13ca9f2c: e9 8c bf 00 ld r12,-16640(r12)
13ca9f30: 7d 89 03 a6 mtctr r12
13ca9f34: 4e 80 04 20 bctr
13ca9f38: 4b ff ff f1 bl 13ca9f28 <__long_branch_frame_dummy>
13ca9f3c: 60 00 00 00 nop
13ca9f40: 4b ff ff 59 bl 13ca9e98 <__do_global_ctors_aux+0x8>
13ca9f44: 60 00 00 00 nop
13ca9f48: e8 21 00 00 ld r1,0(r1)
13ca9f4c: e8 01 00 10 ld r0,16(r1)
13ca9f50: 7c 08 03 a6 mtlr r0
13ca9f54: 4e 80 00 20 blr
Looks like long-branch-thunk code need to handle .init section as an special
case when the second part of init lands in a higher address.</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>