[all-commits] [llvm/llvm-project] 3c9100: [lld-macho] Support dynamic linking of thread-locals

Jez Ng via All-commits all-commits at lists.llvm.org
Wed Aug 12 19:51:11 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 3c9100fb785c400c457ce83ba724a3b762b2348a
      https://github.com/llvm/llvm-project/commit/3c9100fb785c400c457ce83ba724a3b762b2348a
  Author: Jez Ng <jezng at fb.com>
  Date:   2020-08-12 (Wed, 12 Aug 2020)

  Changed paths:
    M lld/MachO/Arch/X86_64.cpp
    M lld/MachO/ExportTrie.cpp
    M lld/MachO/InputFiles.cpp
    M lld/MachO/InputSection.cpp
    M lld/MachO/InputSection.h
    M lld/MachO/SymbolTable.cpp
    M lld/MachO/SymbolTable.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/invalid/bad-got-to-dylib-tlv-reference.s
    A lld/test/MachO/invalid/bad-got-to-tlv-reference.s
    A lld/test/MachO/invalid/bad-tlv-relocation.s
    A lld/test/MachO/tlv-dylib.s

  Log Message:
  -----------
  [lld-macho] Support dynamic linking of thread-locals

References to symbols in dylibs work very similarly regardless of
whether the symbol is a TLV. The main difference is that we have a
separate `__thread_ptrs` section that acts as the GOT for these
thread-locals.

We can identify thread-locals in dylibs by a flag in their export trie
entries, and we cross-check it with the relocations that refer to them
to ensure that we are not using a GOT relocation to reference a
thread-local (or vice versa).

Reviewed By: #lld-macho, smeenai

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


  Commit: a499898e86ec322ed47b43aaabdd3fedbf58840a
      https://github.com/llvm/llvm-project/commit/a499898e86ec322ed47b43aaabdd3fedbf58840a
  Author: Jez Ng <jezng at fb.com>
  Date:   2020-08-12 (Wed, 12 Aug 2020)

  Changed paths:
    M lld/MachO/InputFiles.cpp
    M lld/test/MachO/Inputs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation.tbd
    M lld/test/MachO/stub-link.s

  Log Message:
  -----------
  [lld-macho] Generate ObjC symbols from .tbd files

I followed similar logic in TapiFile.cpp.

Reviewed By: #lld-macho, smeenai

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


  Commit: 7e6d6754998058457c2ec94e89daf7f998d970a0
      https://github.com/llvm/llvm-project/commit/7e6d6754998058457c2ec94e89daf7f998d970a0
  Author: Jez Ng <jezng at fb.com>
  Date:   2020-08-12 (Wed, 12 Aug 2020)

  Changed paths:
    M lld/MachO/Driver.cpp
    M lld/MachO/InputFiles.cpp
    M lld/MachO/InputFiles.h

  Log Message:
  -----------
  [lld-macho] Avoid unnecessary shared_ptr in DylibFile ctor

DylibFile doesn't store a pointer to its InterfaceFile
parameter, so there's no need to use a shared_ptr.

Reviewed By: #lld-macho, compnerd

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


  Commit: c3eb1e27547094405bc0ecbbd7b993912106c28c
      https://github.com/llvm/llvm-project/commit/c3eb1e27547094405bc0ecbbd7b993912106c28c
  Author: Jez Ng <jezng at fb.com>
  Date:   2020-08-12 (Wed, 12 Aug 2020)

  Changed paths:
    M lld/MachO/Driver.cpp
    A lld/test/MachO/invalid/invalid-stub.s

  Log Message:
  -----------
  [lld-macho] Add error handling for malformed TBD files

Previously, lld would crash while complaining that `Expected<T>
must be checked before access or destruction`.

Reviewed By: #lld-macho, compnerd

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


  Commit: 180ad756ec5c41b7771404a5da13af7f268f4859
      https://github.com/llvm/llvm-project/commit/180ad756ec5c41b7771404a5da13af7f268f4859
  Author: Jez Ng <jezng at fb.com>
  Date:   2020-08-12 (Wed, 12 Aug 2020)

  Changed paths:
    M lld/MachO/SyntheticSections.cpp

  Log Message:
  -----------
  [lld-macho] Support larger dylib symbol ordinals in bindings

Do folks care if we don't have a test for this? Creating 16
dylibs to trigger this straightforward code path seems a little tedious

Reviewed By: #lld-macho, smeenai

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


  Commit: 437e6bd286acc2515b0b4eb622c2a2e9539e1ab6
      https://github.com/llvm/llvm-project/commit/437e6bd286acc2515b0b4eb622c2a2e9539e1ab6
  Author: Jez Ng <jezng at fb.com>
  Date:   2020-08-12 (Wed, 12 Aug 2020)

  Changed paths:
    M lld/MachO/Driver.cpp
    A lld/test/MachO/force-load.s
    M lld/test/MachO/invalid/bad-archive.s

  Log Message:
  -----------
  [lld-macho] Implement -force_load

It's similar to lld-ELF's `-whole-archive`, but applied to individual
archives instead of to a series of them.

Reviewed By: #lld-macho, smeenai

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


  Commit: e48d1262b88f7088f3e2b41b459f508829a2ea1c
      https://github.com/llvm/llvm-project/commit/e48d1262b88f7088f3e2b41b459f508829a2ea1c
  Author: Jez Ng <jezng at fb.com>
  Date:   2020-08-12 (Wed, 12 Aug 2020)

  Changed paths:
    M lld/MachO/Config.h
    M lld/MachO/Driver.cpp
    M lld/MachO/Options.td
    M lld/MachO/Writer.cpp
    A lld/test/MachO/rpath.s

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

Pretty straightforward; just emits LC_RPATH for dyld to consume.

Note that lld itself does not yet support dylib lookup via @rpath.

Reviewed By: #lld-macho, compnerd

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


Compare: https://github.com/llvm/llvm-project/compare/65277126bf90...e48d1262b88f


More information about the All-commits mailing list