reland "[lld-link] implement -start-lib and -end-lib"
authorBob Haarman <llvm@inglorion.net>
Tue, 3 Sep 2019 20:32:16 +0000 (20:32 +0000)
committerBob Haarman <llvm@inglorion.net>
Tue, 3 Sep 2019 20:32:16 +0000 (20:32 +0000)
commit7dc5e7a0a4f4d27f3fa09e18907fe6f34767bfe2
tree81a2848d1d8a28bc96d02a0f9617e78d75908da7
parenta0a2ca67fef723968266a33b6824f1948464193a
reland "[lld-link] implement -start-lib and -end-lib"

Summary:
This is a re-land of r370487 with a fix for the use-after-free bug
that rev contained.

This implements -start-lib and -end-lib flags for lld-link, analogous
to the similarly named options in ld.lld. Object files after
-start-lib are included in the link only when needed to resolve
undefined symbols. The -end-lib flag goes back to the normal behavior
of always including object files in the link. This mimics the
semantics of static libraries, but without needing to actually create
the archive file.

Reviewers: ruiu, smeenai, MaskRay

Reviewed By: ruiu, MaskRay

Subscribers: akhuang, llvm-commits

Tags: #llvm

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

llvm-svn: 370816
15 files changed:
lld/COFF/DebugTypes.cpp
lld/COFF/Driver.cpp
lld/COFF/Driver.h
lld/COFF/InputFiles.cpp
lld/COFF/InputFiles.h
lld/COFF/Options.td
lld/COFF/SymbolTable.cpp
lld/COFF/SymbolTable.h
lld/COFF/Symbols.cpp
lld/COFF/Symbols.h
lld/COFF/Writer.cpp
lld/test/COFF/Inputs/start-lib1.ll [new file with mode: 0644]
lld/test/COFF/Inputs/start-lib2.ll [new file with mode: 0644]
lld/test/COFF/start-lib-cmd-diagnostics.ll [new file with mode: 0644]
lld/test/COFF/start-lib.ll [new file with mode: 0644]