[llvm-bugs] [Bug 40740] New: [PowerPC64] [ELFv2] wrong .init section for large binaries (long branch thunk)
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Feb 15 07:23:38 PST 2019
https://bugs.llvm.org/show_bug.cgi?id=40740
Bug ID: 40740
Summary: [PowerPC64] [ELFv2] wrong .init section for large
binaries (long branch thunk)
Product: lld
Version: unspecified
Hardware: Other
OS: FreeBSD
Status: NEW
Severity: normal
Priority: P
Component: ELF
Assignee: unassignedbugs at nondot.org
Reporter: alfredo.junior at eldorado.org.br
CC: llvm-bugs at lists.llvm.org, peter.smith at linaro.org
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 at 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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190215/7b52f42d/attachment.html>
More information about the llvm-bugs
mailing list