[all-commits] [llvm/llvm-project] 3e6b6c: [lld/mac] Use libSystem.dylib instead of libSystem...

Nico Weber via All-commits all-commits at lists.llvm.org
Mon Mar 1 12:26:29 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3e6b6cee00819d256f30e84aec7ae634e0725534
      https://github.com/llvm/llvm-project/commit/3e6b6cee00819d256f30e84aec7ae634e0725534
  Author: Nico Weber <thakis at chromium.org>
  Date:   2021-03-01 (Mon, 01 Mar 2021)

  Changed paths:
    M lld/test/MachO/Inputs/MacOSX.sdk/usr/lib/libSystem.tbd
    M lld/test/MachO/Inputs/iPhoneSimulator.sdk/usr/lib/libSystem.tbd
    M lld/test/MachO/implicit-dylibs.s
    M lld/test/MachO/lc-linker-option.ll
    M lld/test/MachO/link-search-order.s
    M lld/test/MachO/stub-link.s
    M lld/test/MachO/weak-import.s

  Log Message:
  -----------
  [lld/mac] Use libSystem.dylib instead of libSystem.B.dylib in tests

For -flat_namespace, lld needs to load dylibs in LC_LOAD_DYLIB.
The current setup meant that libSystem.dylib would cause a LC_LOAD_DYLIB
with libSystem.B.dylib, but that didn't exist in our libsysroot for
tests. So just drop the .B.

See https://reviews.llvm.org/D97641#2595237 and
https://reviews.llvm.org/D97641#2595270


  Commit: 8174f33dc9bf34e1cde57931e2e028bd4d49c98e
      https://github.com/llvm/llvm-project/commit/8174f33dc9bf34e1cde57931e2e028bd4d49c98e
  Author: Nico Weber <thakis at chromium.org>
  Date:   2021-03-01 (Mon, 01 Mar 2021)

  Changed paths:
    M lld/MachO/Driver.cpp
    M lld/MachO/InputFiles.cpp
    M lld/MachO/Options.td
    M lld/MachO/SymbolTable.cpp
    M lld/MachO/SyntheticSections.cpp
    A lld/test/MachO/flat-namespace.s
    M lld/test/MachO/header.s

  Log Message:
  -----------
  [lld/mac] Add support for -flat_namespace

-flat_namespace makes lld emit binaries that use name lookup that's more in
line with other POSIX systems: Instead of looking up symbols as (dylib,name)
pairs by dyld, they're instead looked up just by name.

-flat_namespace has three effects:

1. MH_TWOLEVEL and MH_NNOUNDEFS are no longer set in the Mach-O header
2. All symbols use BIND_SPECIAL_DYLIB_FLAT_LOOKUP as ordinal
3. When a dylib is added to the link, its dependent dylibs are also added,
   so that lld can verify that no undefined symbols remain at the end of
   a link with -flat_namespace. These transitive dylibs are added for symbol
   resolution, but they are not emitted in LC_LOAD_COMMANDs.

-undefined with -flat_namespace still isn't implemented. Before this change,
it was impossible to hit that combination because -flat_namespace caused a
diagnostic. Now that it no longer does, emit a dedicated temporary diagnostic
when both flags are used.

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


Compare: https://github.com/llvm/llvm-project/compare/2e803ec746ac...8174f33dc9bf


More information about the All-commits mailing list