[all-commits] [llvm/llvm-project] 4e43f1: [lld-macho] Ensure .tbss sections are also conside...

Jez Ng via All-commits all-commits at lists.llvm.org
Fri Aug 7 11:05:22 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 4e43f1804817b36fee62aeb7e1eb1602245efdb6
      https://github.com/llvm/llvm-project/commit/4e43f1804817b36fee62aeb7e1eb1602245efdb6
  Author: Jez Ng <jezng at fb.com>
  Date:   2020-08-07 (Fri, 07 Aug 2020)

  Changed paths:
    M lld/MachO/InputSection.h
    M lld/test/MachO/bss.s

  Log Message:
  -----------
  [lld-macho] Ensure .tbss sections are also considered as ZeroFilled

This diff makes the behavior in {D80859} and {D81888} apply to
thread-local ZeroFill sections too. I realized this was necessary whie
trying to implement thread-local variables.

Reviewed By: #lld-macho, compnerd, MaskRay

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


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

  Changed paths:
    M lld/MachO/Arch/X86_64.cpp
    M lld/MachO/InputSection.cpp
    M lld/MachO/InputSection.h
    M lld/MachO/SyntheticSections.cpp
    M lld/MachO/Target.h
    M lld/test/MachO/Inputs/MacOSX.sdk/usr/lib/libSystem.tbd
    A lld/test/MachO/invalid/bad-tlv-def.s
    A lld/test/MachO/invalid/bad-tlv-opcode.s
    A lld/test/MachO/tlv.s

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

Note: What ELF refers to as "TLS", Mach-O seems to refer to as "TLV", i.e.
thread-local variables.

This diff implements support for TLV relocations that reference defined
symbols. On x86_64, TLV relocations are always used with movq opcodes, so for
defined TLVs, we don't need to create a synthetic section to store the
addresses of the symbols -- we can just convert the `movq` to a `leaq`.

One notable quirk of Mach-O's TLVs is that absolute-address relocations
inside TLV-defining sections behave differently -- their addresses are
no longer absolute, but relative to the start of the target section.
(AFAICT, RIP-relative relocations are not allowed in these sections.)

Reviewed By: #lld-macho, compnerd, smeenai

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


  Commit: 25367dfefb7ba5cc35dc56bf5063562695f1dd04
      https://github.com/llvm/llvm-project/commit/25367dfefb7ba5cc35dc56bf5063562695f1dd04
  Author: Jez Ng <jezng at fb.com>
  Date:   2020-08-07 (Fri, 07 Aug 2020)

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

  Log Message:
  -----------
  [lld-macho] Add .tbd support for frameworks

Required for e.g. linking iOS apps since they don't have a platform-native
SDK

Reviewed By: #lld-macho, compnerd, smeenai

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


Compare: https://github.com/llvm/llvm-project/compare/911565d1085d...25367dfefb7b


More information about the All-commits mailing list