llvm-project/llvm/test/tools/llvm-readobj/COFF
Martin Storsjö 4750a8b1bc Reapply [llvm-readobj] [ARMWinEH] Fix handling of relocations and symbol offsets
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.

Relanded with a format string fix in the formatSymbol function; one
can't use %X as format string for an uint64_t. That bug has been
present since this code was added in e6971cab30.

Differential Revision: https://reviews.llvm.org/D100305
2021-04-30 09:51:23 +03:00
..
Inputs
arm-baserelocs.test
arm64-many-epilogs.s
arm64-packed-epilog.s
arm64-packed-symbol-name.yaml Reapply [llvm-readobj] [ARMWinEH] Fix handling of relocations and symbol offsets 2021-04-30 09:51:23 +03:00
arm64-packed-unwind.s
arm64-unwind-opcodes.s
arm64-unwind-reference.yaml Reapply [llvm-readobj] [ARMWinEH] Fix handling of relocations and symbol offsets 2021-04-30 09:51:23 +03:00
arm64-win-error1.s
arm64-win-error2.s
arm64-win-error3.s
basereloc.test
bigobj.test
call-graph-profile-err.s
call-graph-profile.s
cetcompat.test
codeview-inlinees.test
codeview-inlining.test
codeview-label.test
codeview-linetables.test
codeview-merging-anon.test
codeview-merging-cycle.test
codeview-merging-ghash.test
codeview-merging-unsorted.test
codeview-merging.test
codeview-types.test
codeview-vftable.test
const-import.test
cxx-cli-aux.test
debug-directory-unmapped.test
debug-directory.test
directives.test
exports-implib.test
exports.test
file-headers.test
file-sections-reading.test
hex-dump.test
imports.test
load-config.test
needed-libs.test
non-null-terminated-file.test
peplus.test
reloc-types-coff-i386.test
reloc-types-coff-x64.test
relocations.test
res-resources.test
resources.test
sections-ext.test
sections.test
symbols.test
tls-directory.test
unwind-arm64-image.yaml
unwind-arm64-windows.test
unwind-x86_64-image.yaml
zero-string-table.test