[all-commits] [llvm/llvm-project] e4e673: [lld-macho] Implement support for PIC

Jez Ng via All-commits all-commits at lists.llvm.org
Fri Sep 25 11:29:00 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: e4e673e75a067236c9c4ff2e1ab19d6a3a87003d
      https://github.com/llvm/llvm-project/commit/e4e673e75a067236c9c4ff2e1ab19d6a3a87003d
  Author: Jez Ng <jezng at fb.com>
  Date:   2020-09-25 (Fri, 25 Sep 2020)

  Changed paths:
    M lld/MachO/Arch/X86_64.cpp
    M lld/MachO/Config.h
    M lld/MachO/Driver.cpp
    M lld/MachO/SyntheticSections.cpp
    M lld/MachO/SyntheticSections.h
    M lld/MachO/Writer.cpp
    A lld/test/MachO/compact-unwind-pie.s
    M lld/test/MachO/dylink-lazy.s
    M lld/test/MachO/local-got.s
    M lld/test/MachO/x86-64-reloc-unsigned.s

  Log Message:
  -----------
  [lld-macho] Implement support for PIC

* Implement rebase opcodes. Rebase opcodes tell dyld where absolute
  addresses have been encoded in the binary. If the binary is not loaded
  at its preferred address, dyld has to rebase these addresses by adding
  an offset to them.
* Support `-pie` and use it to test rebase opcodes.

This is necessary for absolute address references in dylibs, bundles etc
to work.

Reviewed By: #lld-macho, gkm

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


  Commit: f23f5126912b7da3f2a118a7cb1bcf6be3d8c1bc
      https://github.com/llvm/llvm-project/commit/f23f5126912b7da3f2a118a7cb1bcf6be3d8c1bc
  Author: Jez Ng <jezng at fb.com>
  Date:   2020-09-25 (Fri, 25 Sep 2020)

  Changed paths:
    M lld/MachO/Driver.cpp
    M lld/MachO/Writer.cpp
    M lld/test/MachO/load-commands.s

  Log Message:
  -----------
  [lld-macho] Support -bundle

Not 100% sure but it appears that bundles are almost identical to
dylibs, aside from the fact that they do not contain `LC_ID_DYLIB`. ld64's code
seems to treat bundles and dylibs identically in most places.

Supporting bundles allows us to run e.g. XCTests, as all test suites are
compiled into bundles which get dynamically loaded by the `xctest` test runner.

Reviewed By: #lld-macho, smeenai

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


  Commit: c7c9776f77712eb4311708d884c0c70ccaa7125b
      https://github.com/llvm/llvm-project/commit/c7c9776f77712eb4311708d884c0c70ccaa7125b
  Author: Jez Ng <jezng at fb.com>
  Date:   2020-09-25 (Fri, 25 Sep 2020)

  Changed paths:
    M lld/MachO/Arch/X86_64.cpp
    M lld/MachO/Driver.cpp
    M lld/MachO/SyntheticSections.cpp
    M lld/MachO/SyntheticSections.h
    M lld/MachO/Writer.cpp
    M lld/test/MachO/entry-symbol.s

  Log Message:
  -----------
  [lld-macho] Allow the entry symbol to be dynamically bound

Apparently this is used in real programs. I've handled this by reusing
the logic we already have for branch (function call) relocations.

Reviewed By: #lld-macho, smeenai

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


  Commit: 62a3f0c9844bb89a48173440145b26212be60f83
      https://github.com/llvm/llvm-project/commit/62a3f0c9844bb89a48173440145b26212be60f83
  Author: Jez Ng <jezng at fb.com>
  Date:   2020-09-25 (Fri, 25 Sep 2020)

  Changed paths:
    M lld/MachO/ExportTrie.cpp
    M lld/MachO/InputFiles.cpp
    M lld/MachO/InputFiles.h
    M lld/MachO/SymbolTable.cpp
    M lld/MachO/Symbols.cpp
    M lld/MachO/Symbols.h
    M lld/MachO/SyntheticSections.cpp
    A lld/test/MachO/abs-symbols.s
    A lld/test/MachO/invalid/abs-duplicate.s
    M lld/test/MachO/invalid/dso-handle-duplicate.s

  Log Message:
  -----------
  [lld-macho] Support absolute symbols

They operate like Defined symbols but with no associated InputSection.

Note that `ld64` seems to treat the weak definition flag like a no-op for
absolute symbols, so I have replicated that behavior.

Reviewed By: #lld-macho, smeenai

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


  Commit: 643ec67a64ad7a686361b1d309e5088ad8f228e9
      https://github.com/llvm/llvm-project/commit/643ec67a64ad7a686361b1d309e5088ad8f228e9
  Author: Jez Ng <jezng at fb.com>
  Date:   2020-09-25 (Fri, 25 Sep 2020)

  Changed paths:
    M lld/test/MachO/abs-symbols.s
    M lld/test/MachO/arch.s
    M lld/test/MachO/archive.s
    M lld/test/MachO/bss.s
    M lld/test/MachO/common-symbol-coalescing.s
    M lld/test/MachO/common-symbol-resolution.s
    M lld/test/MachO/compact-unwind-pie.s
    M lld/test/MachO/compact-unwind.test
    M lld/test/MachO/dso-handle.s
    M lld/test/MachO/dylib.s
    M lld/test/MachO/dylink-lazy.s
    M lld/test/MachO/dylink.s
    M lld/test/MachO/entry-symbol.s
    M lld/test/MachO/export-trie.s
    M lld/test/MachO/fat-arch.s
    M lld/test/MachO/filelist.s
    M lld/test/MachO/force-load.s
    M lld/test/MachO/framework.s
    M lld/test/MachO/headerpad.s
    M lld/test/MachO/indirect-symtab.s
    M lld/test/MachO/invalid/abs-duplicate.s
    M lld/test/MachO/invalid/alignment-too-large.yaml
    M lld/test/MachO/invalid/archive-no-index.s
    M lld/test/MachO/invalid/bad-archive.s
    M lld/test/MachO/invalid/bad-got-to-dylib-tlv-reference.s
    M lld/test/MachO/invalid/bad-got-to-tlv-reference.s
    M lld/test/MachO/invalid/bad-tlv-def.s
    M lld/test/MachO/invalid/bad-tlv-opcode.s
    M lld/test/MachO/invalid/bad-tlv-relocation.s
    M lld/test/MachO/invalid/dso-handle-duplicate.s
    M lld/test/MachO/invalid/duplicate-symbol.s
    M lld/test/MachO/invalid/invalid-executable.s
    M lld/test/MachO/invalid/invalid-fat-narch.s
    M lld/test/MachO/invalid/invalid-fat-offset.s
    M lld/test/MachO/invalid/invalid-relocation-length.yaml
    M lld/test/MachO/invalid/invalid-relocation-pcrel.yaml
    M lld/test/MachO/invalid/invalid-stub.s
    M lld/test/MachO/invalid/missing-dylib.s
    M lld/test/MachO/invalid/no-filelist.s
    M lld/test/MachO/invalid/no-id-dylink.yaml
    M lld/test/MachO/invalid/no-such-file.s
    M lld/test/MachO/invalid/order-file-bad-arch.test
    M lld/test/MachO/invalid/order-file-bad-objfile.test
    M lld/test/MachO/invalid/reserved-section-name.s
    M lld/test/MachO/invalid/stub-link.s
    M lld/test/MachO/invalid/undefined-symbol.s
    M lld/test/MachO/lc-build-version.s
    M lld/test/MachO/link-search-order.s
    M lld/test/MachO/linkedit-contiguity.s
    A lld/test/MachO/lit.local.cfg
    M lld/test/MachO/load-commands.s
    M lld/test/MachO/local-got.s
    M lld/test/MachO/no-exports-dylib.s
    M lld/test/MachO/no-unneeded-dyld-info.s
    M lld/test/MachO/nonweak-definition-override.s
    M lld/test/MachO/objc.s
    M lld/test/MachO/order-file.s
    M lld/test/MachO/platform-version.s
    M lld/test/MachO/reexport-stub.s
    M lld/test/MachO/relocations.s
    M lld/test/MachO/resolution.s
    M lld/test/MachO/rpath.s
    M lld/test/MachO/search-paths.test
    M lld/test/MachO/sectcreate.s
    M lld/test/MachO/section-headers.s
    M lld/test/MachO/section-merge.s
    M lld/test/MachO/segments.s
    M lld/test/MachO/silent-ignore.test
    M lld/test/MachO/static-link.s
    M lld/test/MachO/stub-framework.s
    M lld/test/MachO/stub-link.s
    M lld/test/MachO/sub-library.s
    M lld/test/MachO/subsections-section-relocs.s
    M lld/test/MachO/subsections-symbol-relocs.s
    M lld/test/MachO/symbol-order.s
    M lld/test/MachO/symtab.s
    M lld/test/MachO/syslibroot.test
    M lld/test/MachO/tlv-dylib.s
    M lld/test/MachO/tlv.s
    M lld/test/MachO/weak-binding.s
    M lld/test/MachO/weak-definition-direct-fetch.s
    M lld/test/MachO/weak-definition-indirect-fetch.s
    M lld/test/MachO/weak-definition-order.s
    M lld/test/MachO/weak-definition-over-dysym.s
    M lld/test/MachO/weak-header-flags.s
    M lld/test/MachO/weak-import.s
    M lld/test/MachO/x86-64-reloc-got-load.s
    M lld/test/MachO/x86-64-reloc-signed.s
    M lld/test/MachO/x86-64-reloc-unsigned.s

  Log Message:
  -----------
  [lld-macho] Always include custom syslibroot when running tests

This greatly reduces the amount of boilerplate in our tests.

Reviewed By: #lld-macho, compnerd

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


  Commit: 2c2a7494482133ecdd681869e1ccc53b71d27385
      https://github.com/llvm/llvm-project/commit/2c2a7494482133ecdd681869e1ccc53b71d27385
  Author: Jez Ng <jezng at fb.com>
  Date:   2020-09-25 (Fri, 25 Sep 2020)

  Changed paths:
    M lld/MachO/Options.td
    M lld/test/MachO/silent-ignore.test

  Log Message:
  -----------
  [lld-macho] Ignore a few more undocumented flags

Reviewed By: #lld-macho, compnerd

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


Compare: https://github.com/llvm/llvm-project/compare/06104cb9f21d...2c2a74944821


More information about the All-commits mailing list