[all-commits] [llvm/llvm-project] 2b01a4: [LLD] [COFF] Fix the mingw --export-all-symbols be...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Thu Apr 29 13:35:54 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2b01a417d7ccb001ccc1185ef5fdc967c9fac8d7
      https://github.com/llvm/llvm-project/commit/2b01a417d7ccb001ccc1185ef5fdc967c9fac8d7
  Author: Martin Storsjö <martin at martin.st>
  Date:   2021-04-29 (Thu, 29 Apr 2021)

  Changed paths:
    M lld/COFF/MinGW.cpp
    M lld/test/COFF/export-all.s

  Log Message:
  -----------
  [LLD] [COFF] Fix the mingw --export-all-symbols behaviour with comdat symbols

When looking for the "all" symbols that are supposed to be exported,
we can't look at the live flag - the symbols we mark as to be
exported will become GC roots even if they aren't yet marked as live.

With this in place, building an LLVM library with BUILD_SHARED_LIBS
produces the same set of symbols exported regardless of whether the
--gc-sections flag is specified, both with and without being built
with -ffunction-sections.

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


  Commit: 37789240882bfacd951767acdb4c088fcbf53385
      https://github.com/llvm/llvm-project/commit/37789240882bfacd951767acdb4c088fcbf53385
  Author: Martin Storsjö <martin at martin.st>
  Date:   2021-04-29 (Thu, 29 Apr 2021)

  Changed paths:
    A llvm/test/tools/llvm-readobj/COFF/arm64-packed-symbol-name.yaml
    A llvm/test/tools/llvm-readobj/COFF/arm64-unwind-reference.yaml
    M llvm/tools/llvm-readobj/ARMWinEHPrinter.cpp
    M llvm/tools/llvm-readobj/ARMWinEHPrinter.h

  Log Message:
  -----------
  [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.

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


Compare: https://github.com/llvm/llvm-project/compare/8f5a2a5836cc...37789240882b


More information about the All-commits mailing list