[PATCH] D120928: [BOLT] Add new class for symbolizing X86 instructions

Maksim Panchenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 3 11:29:33 PST 2022


maksfb created this revision.
maksfb added reviewers: yota9, rafauler, Amir, ayermolo.
Herald added subscribers: pengfei, hiraditya, mgorny.
Herald added a project: All.
maksfb requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

While disassembling instructions, we need to replace certain immediate
operands with symbols. This symbolizing process relies on reading
relocations against instructions. However, Some X86 instructions can
have multiple immediate operands with up to two relocations against
them. Thus, correctly matching a relocation to an operand is not
always possible without knowing the operand offset within the
instruction.

Luckily, LLVM provides an interface for passing the required info from
the disassembler via a virtual MCSymbolizer class. Creating a
target-specific version allows a precise matching of relocations to
operands.

This diff adds X86MCSymbolizer class that performs X86-specific
symbolizing (currently limited to non-branch instructions).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120928

Files:
  bolt/include/bolt/Core/BinaryContext.h
  bolt/include/bolt/Core/BinaryFunction.h
  bolt/include/bolt/Core/MCPlusBuilder.h
  bolt/lib/Core/BinaryContext.cpp
  bolt/lib/Core/BinaryFunction.cpp
  bolt/lib/Core/CMakeLists.txt
  bolt/lib/Target/X86/CMakeLists.txt
  bolt/lib/Target/X86/X86MCPlusBuilder.cpp
  bolt/lib/Target/X86/X86MCSymbolizer.cpp
  bolt/lib/Target/X86/X86MCSymbolizer.h
  bolt/test/X86/double-rel.s
  llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120928.412786.patch
Type: text/x-patch
Size: 19599 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220303/1fc3488b/attachment.bin>


More information about the llvm-commits mailing list