summaryrefslogtreecommitdiffstats
path: root/lld/COFF/Librarian.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Re-land "COFF: migrate def parser from LLD to LLVM"Reid Kleckner2017-06-021-511/+0
| | | | | | | | | | | | | | | | | | | | | | This reverts commit r304561 and re-lands r303490 & co. The fix was to use "SymbolName" when translating LLD's internal export list to lib/Object's short export struct. The SymbolName reflects the actual symbol name, which may include fastcall and stdcall mangling bits not included in the /EXPORT or .def file EXPORTS name: @@ -434,8 +434,7 @@ std::vector<COFFShortExport> createCOFFShortExportFromConfig() { std::vector<COFFShortExport> Exports; for (Export &E1 : Config->Exports) { COFFShortExport E2; - E2.Name = E1.Name; + // Use SymbolName, which will have any stdcall or fastcall qualifiers. + E2.Name = E1.SymbolName; E2.ExtName = E1.ExtName; E2.Ordinal = E1.Ordinal; E2.Noname = E1.Noname; llvm-svn: 304573
* Revert "COFF: migrate def parser from LLD to LLVM"Reid Kleckner2017-06-021-0/+511
| | | | | | | | | | This reverts commits r303490, r303491, r303493, and r303494. This caused http://crbug.com/728726. Essentially, exporting stdcall functions doesn't appear to work after this change. Reduced test case soon. llvm-svn: 304561
* COFF: migrate def parser from LLD to LLVM [2/2]Martell Malone2017-05-201-511/+0
| | | | | | | | | | | | This is split up into two commits. This commit removes the DEF parser from LLD See the previous commit for the creation in LLVM. Reviewers: ruiu Differential Revision: https://reviews.llvm.org/D32689 llvm-svn: 303491
* COFF: add support for CONSTANT exportsSaleem Abdulrasool2017-04-211-7/+13
| | | | | | | | The CONSTANT export type is marked as obsolete, but link still supports this. Furthermore, WinObjC uses this for certain exports. Add support for this export type. llvm-svn: 301013
* Fix wrong assertion failure.Rui Ueyama2017-03-091-0/+8
| | | | | | | | | | Previously, if you have foo=bar in a definition file, this assertion could fire because when symbols are read from file they could be mangled. It seems that due to historical reasons underscore mangling scheme is really ad-hoc, and I cannot find a clean way to handle this. I had to just de-mangle symbols to search again. llvm-svn: 297357
* Print an error message instead of an assertion failure.Rui Ueyama2017-03-091-1/+4
| | | | | | | This assertion is failing on a Chromium builder and I cannot figure out why. This patch let it print out more info. llvm-svn: 297353
* Remove unnecessary `llvm::`.Rui Ueyama2016-12-081-1/+1
| | | | llvm-svn: 289102
* Make the .idata$4 and .idata$5 import lib sections 8 bytes on x64Reid Kleckner2016-11-101-15/+20
| | | | | | | | The MSVC linker relies on this invariant to produce a valid import table. More ASan tests pass in a stage 2 build now. They still fail when using LLD since there are no PDBs for the dynamic ASan runtime. llvm-svn: 286499
* Unpollute the global namespace. lld edition.Benjamin Kramer2016-08-061-1/+1
| | | | llvm-svn: 277926
* COFF: Update error messages so that they start with lowercase letters.Rui Ueyama2016-07-151-1/+1
| | | | llvm-svn: 275513
* COFF: Remove `void error()` functions and use fatal instead.Rui Ueyama2016-07-151-1/+2
| | | | | | This change makes the control flow more explicit. llvm-svn: 275504
* COFF: Rename non-noreturn error -> check.Rui Ueyama2016-07-141-2/+1
| | | | | | The new name is consistent with ELF. llvm-svn: 275499
* COFF: drop the dependency on LIB.EXE for implibsSaleem Abdulrasool2016-07-131-0/+489
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
OpenPOWER on IntegriCloud