[all-commits] [llvm/llvm-project] 17c43c: [lld/mac] Add reexports after reexporter to inputF...

Nico Weber via All-commits all-commits at lists.llvm.org
Mon Jun 7 14:04:21 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 17c43c404535fe427d2cddb665154ae601d505bd
      https://github.com/llvm/llvm-project/commit/17c43c404535fe427d2cddb665154ae601d505bd
  Author: Nico Weber <thakis at chromium.org>
  Date:   2021-06-07 (Mon, 07 Jun 2021)

  Changed paths:
    M lld/MachO/Driver.cpp
    M lld/MachO/InputFiles.cpp
    M lld/test/MachO/implicit-dylibs.s
    M lld/test/MachO/special-symbol-ld-install-name.s
    M lld/test/MachO/tapi-link.s

  Log Message:
  -----------
  [lld/mac] Add reexports after reexporter to inputFiles

When a library "host"'s reexports change their installName with
`$ld$os10.11$install_name$host`, we used to write a load command for "host" but
write the version numbers of the reexport instead of "host". This fixes that.

I first thought that the rule is to take the version numbers from the library
that originally had that install name (implemented in D103819), but that's not
what ld64 seems to be doing: It takes the version number from the first dylib
with that install name it loads, and it loads the reexporting library before
the reexports. We already did most of that, we just added reexports before the
reexporter. After this change, we add the reexporter before the reexports.

Addresses https://bugs.llvm.org/show_bug.cgi?id=49800#c11 part 1.

(ld64 seems to add reexports after processing _all_ files on the command line,
while we add them right after the reexporter. For the common case of reexport +
$ld$ symbol changing back to the exporter name, this doesn't make a difference,
but you can construct a case where it does. I expect this to not make a
difference in practice though.)

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




More information about the All-commits mailing list