[all-commits] [llvm/llvm-project] c27866: [JITLink][MachO] Add support for non-subsections-v...

lhames via All-commits all-commits at lists.llvm.org
Wed Aug 17 16:00:12 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c2786683caa9d5011eda7429fcbe46e5987c8cd0
  Author: Lang Hames <lhames at gmail.com>
  Date:   2022-08-17 (Wed, 17 Aug 2022)

  Changed paths:
    M llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp
    M llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.h
    M llvm/test/ExecutionEngine/JITLink/X86/Inputs/x86-64_self_relocation.s
    M llvm/test/ExecutionEngine/JITLink/X86/MachO-duplicate-local.test
    M llvm/test/ExecutionEngine/JITLink/X86/MachO_archive_load_hidden_expect_success.s
    M llvm/test/ExecutionEngine/JITLink/X86/MachO_archive_support.s
    A llvm/test/ExecutionEngine/JITLink/X86/MachO_non_subsections_via_symbols.s
    M llvm/test/ExecutionEngine/JITLink/X86/MachO_weak_local.s

  Log Message:
  [JITLink][MachO] Add support for non-subsections-via-symbols objects.

This patch updates MachOLinkGraphBuilder to honor the MH_SUBSECTIONS_VIA_SYMBOLS
flag. Prior to this patch we assumed MH_SUBSECTIONS_VIA_SYMBOLS, but never
checked the flag.

If MH_SUBSECTIONS_VIA_SYMBOLS is set (the default for MachO output on modern
compilers) then MachOLinkGraphBuilder will break MachO section content into
jitlink::Blocks on symbol boundaries. (This is how JITLink has always handled
MachO sections previously).

If MH_SUBSECTIONS_VIA_SYMBOLS is not set then MachOLinkGraphBuilder will create
a single jitlink::Block for each MachO section.

Existing hand-written testcases that were _not_ using the
.subsections_via_symbols directive are updated to use it. A new testcase for
non-subsections-via-symbols behavior is included.

  Commit: 64949209871c736bdb123a03784ec89ab7fa581d
  Author: Lang Hames <lhames at gmail.com>
  Date:   2022-08-17 (Wed, 17 Aug 2022)

  Changed paths:
    M llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h

  Log Message:
  [JITLink] Pass Allocator (rather than storage) into Symbol named constructors.

Also switch from orc::ExecutorAddrDiff to uint64_t for the Symbol::Size field.

These changes help to prepare for the introduction of symbol alias support:
Aliases will require an auxiliary data structure which will also need to be
allocated (hence the need to pass the allocator down). The Size field will be
re-tasked to track the auxiliary data (which will hold a replacement Size field)
if the symbol is either an alias, or aliased by some other symbol.

  Commit: f1b5d30f152e4502e3d201ed7eca3f28204e1d36
  Author: Lang Hames <lhames at gmail.com>
  Date:   2022-08-17 (Wed, 17 Aug 2022)

  Changed paths:
    M llvm/unittests/ExecutionEngine/JITLink/LinkGraphTests.cpp

  Log Message:
  [JITLink] Fix typo in block address in unittest.

The address isn't currently used in this test but overlaps with Block B1,
which is a dubious state for a LinkGraph to be in.

Compare: https://github.com/llvm/llvm-project/compare/e5edd74bb77e...f1b5d30f152e

More information about the All-commits mailing list