[llvm-bugs] [Bug 45411] New: Unstable call instruction disassembly output if empty sections in linked ELF
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Apr 3 02:11:57 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=45411
Bug ID: 45411
Summary: Unstable call instruction disassembly output if empty
sections in linked ELF
Product: tools
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: llvm-objdump
Assignee: unassignedbugs at nondot.org
Reporter: jh7370.2008 at my.bristol.ac.uk
CC: llvm-bugs at lists.llvm.org
If a fully-linked ELF (i.e. not ET_REL) containing empty sections is
disassembled, the output of call instructions may be unstable - the symbol
referenced may change between runs, even though the input is unchanged. My
guess is that the use of partition_point does not work reliably when there are
multiple sections with the same address - it appears to sometimes pick the
empty section and therefore not use the symbols from the right section at all.
More generally, the disassembler probably shouldn't be using section
information in identifying symbols at all when disassembling a fully linked
ELF, but perhaps that's outside the scope of this issue.
Reproducible (in all cases, "bob" should be picked, not the absolute symbol):
// bar.s
.global _start
.global bob
.global abs
abs = 1
.section .section.call,"ax", at progbits
_start:
call bob at PLT
.section .section.empty,"ax"
.section .section.bob,"ax"
bob:
ret
C:\Work\TempWork> C:\llvm\build\Debug\bin\clang.exe -c bar.s
C:\Work\TempWork> C:\llvm\build\Debug\bin\ld.lld.exe bar.o -o bar.elf
C:\Work\TempWork> C:\llvm\build\Debug\bin\llvm-objdump -d bar.elf
bar.elf: file format elf64-x86-64
Disassembly of section .section.call:
0000000000201120 <_start>:
201120: e8 00 00 00 00 callq 0x201125 <abs+0x201124>
Disassembly of section .section.bob:
0000000000201125 <bob>:
201125: c3 retq
C:\Work\TempWork> C:\llvm\build\Debug\bin\llvm-objdump -d bar.elf
bar.elf: file format elf64-x86-64
Disassembly of section .section.call:
0000000000201120 <_start>:
201120: e8 00 00 00 00 callq 0x201125 <bob>
Disassembly of section .section.bob:
0000000000201125 <bob>:
201125: c3 retq
--
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/20200403/990da55f/attachment.html>
More information about the llvm-bugs
mailing list