[all-commits] [llvm/llvm-project] 63ace7: [lld-macho] Initial support for common symbols

Jez Ng via All-commits all-commits at lists.llvm.org
Wed Sep 23 19:27:01 PDT 2020


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

  Changed paths:
    M lld/MachO/Driver.cpp
    M lld/MachO/InputFiles.cpp
    M lld/MachO/SymbolTable.cpp
    M lld/MachO/SymbolTable.h
    M lld/MachO/Symbols.h
    M lld/MachO/SyntheticSections.h
    A lld/test/MachO/common-symbol-coalescing.s

  Log Message:
  -----------
  [lld-macho] Initial support for common symbols

On Unix, it is traditionally allowed to write variable definitions without
initialization expressions (such as "int foo;") to header files. These are
called tentative definitions.

The compiler creates common symbols when it sees tentative definitions. When
linking the final binary, if there are remaining common symbols after name
resolution is complete, the linker converts them to regular defined symbols in
a `__common` section.

This diff implements most of that functionality, though we do not yet handle
the case where there are both common and non-common definitions of the same
symbol.

Reviewed By: #lld-macho, gkm

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


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

  Changed paths:
    M lld/MachO/SymbolTable.cpp
    A lld/test/MachO/common-symbol-resolution.s
    M lld/test/MachO/nonweak-definition-override.s

  Log Message:
  -----------
  [lld-macho] Implement and test resolution of common symbols

Handle the case where there are both common and non-common definitions
of the same symbol. Add a bunch of tests to ensure compatibility with ld64.

Reviewed By: #lld-macho, gkm

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


  Commit: 5d26bd3b75538515194d9e54c76e723524c1ac18
      https://github.com/llvm/llvm-project/commit/5d26bd3b75538515194d9e54c76e723524c1ac18
  Author: Jez Ng <jezng at fb.com>
  Date:   2020-09-23 (Wed, 23 Sep 2020)

  Changed paths:
    M lld/MachO/OutputSection.h
    M lld/MachO/Symbols.h
    M lld/MachO/SyntheticSections.cpp
    M lld/MachO/SyntheticSections.h
    M lld/MachO/Writer.cpp
    A lld/test/MachO/indirect-symtab.s

  Log Message:
  -----------
  [lld-macho] Emit indirect symbol table

Makes it a little easier to read objdump's disassembly.

Reviewed By: #lld-macho, gkm

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


  Commit: 79412d6ca772c1c3913030cfef4b17f4afac110d
      https://github.com/llvm/llvm-project/commit/79412d6ca772c1c3913030cfef4b17f4afac110d
  Author: Jez Ng <jezng at fb.com>
  Date:   2020-09-23 (Wed, 23 Sep 2020)

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

  Log Message:
  -----------
  [lld-macho] Ignore `-mllvm` and its argument

Test Plan:

Reviewed By: #lld-macho, compnerd, MaskRay

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


  Commit: 98f03908d07d06c74be5547cc0436bd89186cae2
      https://github.com/llvm/llvm-project/commit/98f03908d07d06c74be5547cc0436bd89186cae2
  Author: Jez Ng <jezng at fb.com>
  Date:   2020-09-23 (Wed, 23 Sep 2020)

  Changed paths:
    M lld/MachO/Driver.cpp
    M lld/MachO/InputFiles.h
    M lld/MachO/Options.td
    M lld/MachO/Writer.cpp
    A lld/test/MachO/weak-import.s

  Log Message:
  -----------
  [lld-macho] Support -weak_lx, -weak_library, -weak_framework

They cause their corresponding libraries / frameworks to be loaded via
`LC_LOAD_WEAK_DYLIB` instead of `LC_LOAD_DYLIB`.

Reviewed By: #lld-macho, gkm

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


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

  Changed paths:
    M lld/MachO/Driver.cpp

  Log Message:
  -----------
  [lld-macho][NFC] Refactor syslibroot / library path lookup

* Move computation of systemLibraryRoots into a separate function, so we
  can add more functionality to it without things becoming unwieldy
* Have `getSearchPaths` and related functions return by value instead of
  by output parameter. NRVO should ensure that performance is unaffected.

Reviewed By: #lld-macho, smeenai

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


Compare: https://github.com/llvm/llvm-project/compare/41d6669f1f16...ca8752a793f1


More information about the All-commits mailing list