hanchenye-llvm-project/lld/COFF
Saleem Abdulrasool f27d4068a5 COFF: drop the dependency on LIB.EXE for implibs
lld currently relies on lib.exe in order to generate an empty import library.
The "empty" import library consists of 5 members:
  - first linker member
  - second linker member
  - Import Descriptor
  - NULL Import Descriptor
  - NULl Thunk

The first two entries (first and second linker members) are string tables which
are never updated.  Therefore, they may as well as not be present.  A subsequent
change to add that is probably warranted.  However, this does not prevent the
use of the linker.

The Import Descriptor is the content which is most important.  It provides an
Import Name Table entry for the library (as specified by the LIBRARY directive
in the DEF file).  Additionally, it contains undefined references to the NULL
Import Descriptor and the library NULL Thunk Data.  This ensures that the linker
will pull in the subsequent objects from the import library for the link.  The
Import Descriptor has a single symbol (__IMPORT_DESCRIPTOR_<Library>) which
contains 3 relocations, one to the INT (Import Name Table) entry, one to the ILT
(Import Lookup Table) entry, and one to the IAT (Import Address Table) entry.

The NULL Import Descriptor is the last import descriptor and terminates the
import descriptor array.  It contains a single symbol
(__NULL_IMPORT_DESCRIPTOR).

The NULL Thunk contains a single symbol (\x7f<Library>_NULL_THUNK_DATA) and
provides the terminator for the ILT and IAT.

These files are currently constructed manually following the example of the
Short Import Library format.  This is arguably less than ideal, and it may be
possible to use MCAssembler and feed it the fragments to construct the object.

The major difference between the LIB (LINK) generated objects and the ones
generated here is that they are all one section shorter (.debug$S) as they do
not contain the debug information and one symbol shorter (@comp.id) as they do
not contain the RICH signature.

Move the logic related to the librarian into a new source file (Librarian.cpp).

llvm-svn: 275242
2016-07-13 03:19:27 +00:00
..
CMakeLists.txt COFF: drop the dependency on LIB.EXE for implibs 2016-07-13 03:19:27 +00:00
Chunks.cpp [COFF] Use coff_section::getAlignment 2016-03-17 16:58:08 +00:00
Chunks.h Apply clang-tidy's misc-move-constructor-init to lld. 2016-06-03 16:57:13 +00:00
Config.h [COFF] Add /section command line flag. 2016-06-20 03:39:39 +00:00
DLL.cpp
DLL.h
Driver.cpp [COFF] Add /section command line flag. 2016-06-20 03:39:39 +00:00
Driver.h COFF: remove unused function (touchFile) 2016-07-08 18:36:56 +00:00
DriverUtils.cpp COFF: drop the dependency on LIB.EXE for implibs 2016-07-13 03:19:27 +00:00
Error.cpp COFF: Switch to new archive writer interface (D21721). 2016-06-29 22:27:45 +00:00
Error.h Fix logic error in check() function. 2016-06-30 00:32:24 +00:00
ICF.cpp Rename so that the function name is consistent between ELF and COFF. 2016-02-25 18:49:11 +00:00
InputFiles.cpp Matching change for lld for the llvm change of Archive::create() from ErrorOr<...> to Expected<...> in r274160. 2016-06-29 20:36:11 +00:00
InputFiles.h Do not use llvm::getGlobalContext(). 2016-04-14 21:41:44 +00:00
Librarian.cpp COFF: drop the dependency on LIB.EXE for implibs 2016-07-13 03:19:27 +00:00
MarkLive.cpp
ModuleDef.cpp
Options.td COFF: Support /manifestinput command line option. 2016-04-19 01:21:58 +00:00
PDB.cpp
README.md Update the documents of the new LLD. 2016-03-12 06:06:40 +00:00
SymbolTable.cpp Update for llvm change. 2016-05-26 20:31:06 +00:00
SymbolTable.h [COFF] SmallVector<char, 0> -> SmallString<0>. 2016-04-09 23:00:31 +00:00
Symbols.cpp [COFF] Remove an unused function, getFileOff 2016-03-15 09:48:18 +00:00
Symbols.h [COFF] Remove an unused function, getFileOff 2016-03-15 09:48:18 +00:00
Writer.cpp [COFF] Add /section command line flag. 2016-06-20 03:39:39 +00:00
Writer.h

README.md

See docs/NewLLD.rst