[PATCH] D100305: [llvm-readobj] [ARMWinEH] Fix handling of relocations and symbol offsets

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 12 08:09:23 PDT 2021


mstorsjo created this revision.
mstorsjo added reviewers: rnk, efriedma.
Herald added subscribers: rupprecht, kristof.beyls.
Herald added a reviewer: jhenderson.
mstorsjo requested review of this revision.
Herald added a subscriber: MaskRay.
Herald added a project: LLVM.

When looking up data referenced from pdata/xdata structures, the
referenced data can be found in two different ways:

- For an unrelocated object file, it's located via a relocation
- For a relocated, linked image, the data is referenced with an (image relative) absolute address

For the latter case, the absolute address can optionally be
described with a symbol.

For the case of an object file, there's two offsets involved; one
immediate offset encoded in the data location that is modified by
the relocation, and a section offset in the symbol.

Previously, for the ExceptionRecord field, we printed the offset
from the symbol (only) but used the immediate offset ignoring
the symbol's address (using only the symbol's section) for printing
the exception data.

Add a helper method for doing the lookup and address calculation,
for simplifying the calling code and making all the cases consistent.

This addresses an existing FIXME comment, fixing printing of the
exception data for cases where relocations point at individual
symbols in the xdata section (which is what MSVC generates) instead of
all relocations pointing at the start of the xdata section (which is
what LLVM generates).

This also fixes printing of the function name for packed entries in
linked images.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100305

Files:
  llvm/test/tools/llvm-readobj/COFF/arm64-packed-symbol-name.yaml
  llvm/test/tools/llvm-readobj/COFF/arm64-unwind-reference.yaml
  llvm/tools/llvm-readobj/ARMWinEHPrinter.cpp
  llvm/tools/llvm-readobj/ARMWinEHPrinter.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100305.336837.patch
Type: text/x-patch
Size: 20471 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210412/65eba787/attachment.bin>


More information about the llvm-commits mailing list