[PATCH] D86762: [ELF] Add documentation for --warn-backrefs: a layering check tool

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 14:17:50 PDT 2020


smeenai added a comment.
Herald added a subscriber: danielkiss.

In D86762#2244647 <https://reviews.llvm.org/D86762#2244647>, @amccarth wrote:

> Is there a more specific term than "traditional linker"?
>
> I understand that LLD's search strategy is uncommon among linkers in the Posix (and/or ELF?) realm, but it's not uncommon in other linkers, even very old ones.  For example, the VMS (now OpenVMS) linker has used LLD's strategy by default for many decades.  (It does allow opting in to the more restrictive search.)  LLD's approach matches Microsoft's link.exe.  I can't be sure, but I don't recall the so-called traditional behavior from linkers from other vendors of Windows, DOS, or CP/M linkers.
>
> I have no objection to turning the warning on in appropriate contexts or with the argument that it helps to ensure good layering.  I'm just quibbling over the term "traditional."

I can't speak to VMS, but both link.exe and ld64 (Apple's linker) have subtle differences from LLD's behavior (and you can craft examples that show the differences). For link.exe, quoting the documentation <https://docs.microsoft.com/en-us/cpp/build/reference/link-input-files?view=vs-2019>:

> Object files on the command line are processed in the order they appear on the command line. Libraries are searched in command line order as well, with the following caveat: Symbols that are unresolved when bringing in an object file from a library are searched for in that library first, and then the following libraries from the command line and /DEFAULTLIB (Specify Default Library) directives, and then to any libraries at the beginning of the command line.

ld64 fetches symbols from archives that appear on the command line before the objects that reference the symbol (like LLD, and unlike a traditional Unix linker), but if an archive and an object file define the same symbol, it always prefers the object file (whereas LLD will prefer whichever appears first on the command line).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86762/new/

https://reviews.llvm.org/D86762



More information about the llvm-commits mailing list