[PATCH] D139131: [llvm-objdump] Avoid using mapping symbols as branch target labels

Kristina Bessonova via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 1 11:17:46 PST 2022


krisb created this revision.
krisb added reviewers: ikudrin, MaskRay, simon_tatham.
Herald added subscribers: StephenFan, dmgreen, kristof.beyls.
Herald added a reviewer: jhenderson.
Herald added a project: All.
krisb requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The main motivation for this change is to avoid ambiguity because
mapping symbol names may not be unique across a binary and do not allow uniquely
identifying target address. So that mapping symbols used as branch target
labels make llvm-objdump output less readable.

Another point is that mapping symbols sometimes appear in
non-allocatable sections, like debug info sections which make objdump
output even more confusing.

For example, a small AArch64 executable would contain plenty of `$d[.*]`
symbols and none of them would be useful as a label (base) for resolving
a branch or a memory operand target address:

  0000000000000254 l       .note.ABI-tag	0000000000000000 $d
  00000000000008d4 l       .eh_frame            0000000000000000 $d
  0000000000000868 l       .rodata              0000000000000000 $d
  0000000000011028 l       .data                0000000000000000 $d
  0000000000010db8 l       .fini_array          0000000000000000 $d
  0000000000010db0 l       .init_array          0000000000000000 $d
  00000000000008e8 l       .eh_frame            0000000000000000 $d
  0000000000011034 l       .bss                 0000000000000000 $d
  0000000000000165 l       .debug_abbrev	0000000000000000 $d.1
  0000000000000553 l       .debug_info    	0000000000000000 $d.2
  0000000000000000 l       .debug_str_offsets	0000000000000000 $d.3
  000000000000039c l       .debug_str           0000000000000000 $d.4
  0000000000000000 l       .debug_addr          0000000000000000 $d.5
  00000000000000c1 l       .comment             0000000000000000 $d.6
  0000000000000948 l       .eh_frame            0000000000000000 $d.7
  00000000000001d4 l       .debug_line          0000000000000000 $d.8
  0000000000000000 l       .debug_line_str	0000000000000000 $d.9
  0000000000011030 l       .data        	0000000000000000 $d.1
  00000000000001ac l       .debug_abbrev	0000000000000000 $d.2
  00000000000005a1 l       .debug_info    	0000000000000000 $d.3
  0000000000000024 l       .debug_str_offsets	0000000000000000 $d.4
  000000000000039c l       .debug_str           0000000000000000 $d.5
  0000000000000010 l       .debug_addr          0000000000000000 $d.6
  00000000000000c1 l       .comment             0000000000000000 $d.7
  0000000000000948 l       .eh_frame            0000000000000000 $d.8
  0000000000000258 l       .debug_line          0000000000000000 $d.9
  00000000000009a0 l       .eh_frame            0000000000000000 $d

Note that GNU objdump doesn't use mapping symbols as branch target
labels for all targets that support such symbols (ARM, AArch64, CSKY).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D139131

Files:
  llvm/test/CodeGen/AArch64/callbr-asm-obj-file.ll
  llvm/test/MC/ARM/branch-disassemble.s
  llvm/test/MC/Disassembler/ARM/mve-lol.txt
  llvm/tools/llvm-objdump/llvm-objdump.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139131.479370.patch
Type: text/x-patch
Size: 5163 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221201/40f1e3d3/attachment.bin>


More information about the llvm-commits mailing list