[all-commits] [llvm/llvm-project] e29013: [BOLT] Add new class for symbolizing X86 instructions

maksfb via All-commits all-commits at lists.llvm.org
Tue May 31 17:48:55 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e290133c76edb35483cf3280ef59c207af4e29f4
      https://github.com/llvm/llvm-project/commit/e290133c76edb35483cf3280ef59c207af4e29f4
  Author: Maksim Panchenko <maks at fb.com>
  Date:   2022-05-31 (Tue, 31 May 2022)

  Changed paths:
    M bolt/include/bolt/Core/BinaryContext.h
    M bolt/include/bolt/Core/BinaryFunction.h
    M bolt/include/bolt/Core/MCPlusBuilder.h
    M bolt/lib/Core/BinaryContext.cpp
    M bolt/lib/Core/BinaryFunction.cpp
    M bolt/lib/Core/CMakeLists.txt
    M bolt/lib/Target/X86/CMakeLists.txt
    M bolt/lib/Target/X86/X86MCPlusBuilder.cpp
    A bolt/lib/Target/X86/X86MCSymbolizer.cpp
    A bolt/lib/Target/X86/X86MCSymbolizer.h
    A bolt/test/X86/double-rel.s

  Log Message:
  -----------
  [BOLT] Add new class for symbolizing X86 instructions

Summary:
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 and 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).

Reviewers: yota9, Amir, ayermolo, rafauler, zr33

Differential Revision: https://reviews.llvm.org/D120928




More information about the All-commits mailing list