Subclass InputGraph to get darwin linker library semantics
authorNick Kledzik <kledzik@apple.com>
Tue, 21 Oct 2014 21:14:11 +0000 (21:14 +0000)
committerNick Kledzik <kledzik@apple.com>
Tue, 21 Oct 2014 21:14:11 +0000 (21:14 +0000)
commita721db24c08bd64dc3495ce1b20bf8dc182e9656
treef6c85edc39573e521a16e66b36c5754bc0d76133
parent8c4fb7cae09a954b9341f57aff24a32eefe44ba3
Subclass InputGraph to get darwin linker library semantics

The darwin linker operates differently than the gnu linker with respect to
libraries. The darwin linker first links in all object files from the command
line, then to resolve any remaining undefines, it repeatedly iterates over
libraries on the command line until either all undefines are resolved or no
undefines were resolved in the last pass.

When Shankar made the InputGraph model, the plan for darwin was for the darwin
driver to place all libraries in a group at the end of the InputGraph. Thus
making the darwin model a subset of the gnu model. But it turns out that does
not work because the driver cannot tell if a file is an object or library until
it has been loaded, which happens later.

This solution is to subclass InputGraph for darwin and just iterate the graph
the way darwin linker needs.

llvm-svn: 220330
lld/include/lld/Core/InputGraph.h
lld/include/lld/Driver/DarwinInputGraph.h
lld/lib/Core/InputGraph.cpp
lld/lib/Driver/DarwinInputGraph.cpp
lld/lib/Driver/DarwinLdDriver.cpp
lld/test/mach-o/Inputs/libbar.a [new file with mode: 0644]
lld/test/mach-o/lib-search-paths.yaml
lld/test/mach-o/library-order.yaml [new file with mode: 0644]
lld/test/mach-o/library-rescan.yaml [new file with mode: 0644]