https://bugs.llvm.org/show_bug.cgi?id=41886
Bug ID: 41886
Summary: -d/-r/-j should not require relocation sections be
specified with -j
Product: tools
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: llvm-objdump
Assignee: unassignedb...@nondot.org
Reporter: jh7370.2...@my.bristol.ac.uk
CC: llvm-bugs@lists.llvm.org
llvm-objdump -d -r prints relocations inline with the disassembly as follows:
C:\> llvm-objdump -d -r test.o
Disassembly of section .text:
0000000000000400 .text:
400: e8 00 00 00 00 callq 0 <.text+0x5>
0000000000000401: R_X86_64_PC32 foo+1
0000000000000401: R_X86_64_GOT32 foo
Disassembly of section .text2:
0000000000000401 .text2:
401: 90 nop
402: e8 00 00 00 00 callq 0 <.text2+0x6>
0000000000000402: R_X86_64_PLT32 foo+2
This is the same behaviour as GNU objdump. However, if you apply --section, the
behaviour differs. --section for GNU objdump reduces the disassembly down to
the listed sections, and prints all the relocations for those sections (note,
the below output is approximate, and not exactly what GNU objdump prints, but
is used for illustration purposes):
C:\> objdump -d -r test.o --section .text
Disassembly of section .text:
0000000000000400 .text:
400: e8 00 00 00 00 callq 0 <.text+0x5>
0000000000000401: R_X86_64_PC32 foo+1 //from .rela.text
0000000000000401: R_X86_64_GOT32 foo //from
.rela2.text
llvm-objdump only prints the relocations that come from the listed relocations:
C:\> llvm-objdump -d -r test.o --section .text
Disassembly of section .text:
0000000000000400 .text:
400: e8 00 00 00 00 callq 0 <.text+0x5>
// No relocations printed
C:\> llvm-objdump -d -r test.o --section .text --rela.text
Disassembly of section .text:
0000000000000400 .text:
400: e8 00 00 00 00 callq 0 <.text+0x5>
0000000000000401: R_X86_64_PC32 foo+1 //from .rela.text
Intuitively, I didn't expect llvm-objdump to behave the way it does, even
without coming from a GNU background. The behaviour is subtle and could easily
break users. I think we should change the behaviour to match GNU and always
print the relocations for the sections that are disassembled, not just the
filtered set of relocations.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs