diff options
| author | Martin Storsjo <martin@martin.st> | 2018-09-21 22:01:06 +0000 |
|---|---|---|
| committer | Martin Storsjo <martin@martin.st> | 2018-09-21 22:01:06 +0000 |
| commit | 5f6d527f091cb20c176817da9b052aa0840de128 (patch) | |
| tree | 546e7cd77f662ae23c5e91537f6cff8f96fb93b8 /lld/COFF/DLL.cpp | |
| parent | 2e102480accc743d0f7fa84169ff580df4c8de93 (diff) | |
| download | bcm5719-llvm-5f6d527f091cb20c176817da9b052aa0840de128.tar.gz bcm5719-llvm-5f6d527f091cb20c176817da9b052aa0840de128.zip | |
[COFF] Support linking to import libraries from GNU binutils
GNU binutils import libraries aren't the same kind of short import
libraries as link.exe and LLD produce, but are a plain static library
containing .idata section chunks. MSVC link.exe can successfully link
to them.
In order for imports from GNU import libraries to mix properly with the
normal import chunks, the chunks from the existing mechanism needs to
be added into named sections like .idata$2.
These GNU import libraries consist of one header object, a number of
object files, one for each imported function/variable, and one trailer.
Within the import libraries, the object files are ordered alphabetically
in this order. The chunks stemming from these libraries have to be
grouped by what library they originate from and sorted, to make sure
the section chunks for headers and trailers for the lists are ordered
as intended. This is done on all sections named .idata$*, before adding
the synthesized chunks to them.
Differential Revision: https://reviews.llvm.org/D38513
llvm-svn: 342777
Diffstat (limited to 'lld/COFF/DLL.cpp')
| -rw-r--r-- | lld/COFF/DLL.cpp | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/lld/COFF/DLL.cpp b/lld/COFF/DLL.cpp index 8f1692e789d..093eaa5e4f6 100644 --- a/lld/COFF/DLL.cpp +++ b/lld/COFF/DLL.cpp @@ -470,30 +470,6 @@ private: } // anonymous namespace -uint64_t IdataContents::getDirSize() { - return Dirs.size() * sizeof(ImportDirectoryTableEntry); -} - -uint64_t IdataContents::getIATSize() { - return Addresses.size() * ptrSize(); -} - -// Returns a list of .idata contents. -// See Microsoft PE/COFF spec 5.4 for details. -std::vector<Chunk *> IdataContents::getChunks() { - create(); - - // The loader assumes a specific order of data. - // Add each type in the correct order. - std::vector<Chunk *> V; - V.insert(V.end(), Dirs.begin(), Dirs.end()); - V.insert(V.end(), Lookups.begin(), Lookups.end()); - V.insert(V.end(), Addresses.begin(), Addresses.end()); - V.insert(V.end(), Hints.begin(), Hints.end()); - V.insert(V.end(), DLLNames.begin(), DLLNames.end()); - return V; -} - void IdataContents::create() { std::vector<std::vector<DefinedImportData *>> V = binImports(Imports); |

