summaryrefslogtreecommitdiffstats
path: root/lld/COFF/Driver.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [Windows] Remove the #include <eh.h> hack.Zachary Turner2017-03-031-5/+0
| | | | | | | | | | Prior to MSVC 2015 we had to manually include this header any time we were going to include <thread> or <future> due to a bug in MSVC's STL implementation. This has been fixed in MSVC for some time now, and we require VS 2015 minimum, so we can remove this across all subprojects. llvm-svn: 296906
* Fix /msvclto.Rui Ueyama2017-02-231-2/+41
| | | | | | | Previously, bitcode files in library paths were passed to the MSVC linker. This patch strips them. llvm-svn: 295913
* Do not use errs() or outs() directly. Instead use message(), log() or error()Rui Ueyama2017-02-211-7/+5
| | | | | | | | | LLD is a multi-threaded program. errs() or outs() are not guaranteed to be thread-safe (they are actually not). LLD's message(), log() or error() are thread-safe. We should use them. llvm-svn: 295787
* Revert "[COFF] support /ERRORLIMIT option"David Blaikie2017-02-191-54/+27
| | | | | | | | | | | | | Behavior races on ErrorCount. If the enqueued paths are evaluated eagerly (in enqueuePath) then the behavior is as the test expects. But they may not be evaluated until the future is waited on, in run() - which is after the early return/exit on ErrorCount. (this causes the test to fail (because in the "/ERRORCOUNT:XYZ" test, no other errors are printed), at least for me, on linux) This reverts commit r295507. llvm-svn: 295590
* [COFF] support /ERRORLIMIT optionBob Haarman2017-02-171-27/+54
| | | | | | | | | | | | Summary: This adds support for reporting multiple errors in a single invocation of lld-link. The limit defaults to 20 and can be changed with the /ERRORLIMIT command line parameter, or set to unlimited by passing a value of 0. Reviewers: pcc, ruiu Reviewed By: ruiu Differential Revision: https://reviews.llvm.org/D29691 llvm-svn: 295507
* [COFF] added support for /lldsavetempsBob Haarman2017-02-081-0/+4
| | | | | | | | | | | | | | Summary: This adds an option to save temporary files generated during link-time optimization. This can be useful for debugging. Reviewers: ruiu, pcc Reviewed By: ruiu, pcc Subscribers: mehdi_amini Differential Revision: https://reviews.llvm.org/D29518 llvm-svn: 294498
* COFF: ensure that we handle bad argumentsSaleem Abdulrasool2017-02-071-1/+2
| | | | | | | The parameter to /debugtype is user provided and may be invalid. Ensure that we gracefully handle bad input. llvm-svn: 294280
* Add an option to use the MSVC linker to link LTO-generated object files.Rui Ueyama2017-02-061-0/+8
| | | | | | | | | | | This patch defines a new command line option, /MSVCLTO, to LLD. If that option is given, LLD invokes link.exe to link LTO-generated object files. This is hacky but useful because link.exe can create PDB files. Differential Revision: https://reviews.llvm.org/D29526 llvm-svn: 294234
* refactor COFF linker to use new LTO APIBob Haarman2017-02-021-0/+7
| | | | | | | | | | | | | | Summary: The COFF linker previously implemented link-time optimization using an API which has now been marked as legacy. This change refactors the COFF linker to use the new LTO API, which is also used by the ELF linker. Reviewers: pcc, ruiu Reviewed By: pcc Subscribers: mgorny, mehdi_amini Differential Revision: https://reviews.llvm.org/D29059 llvm-svn: 293967
* Remove unused 'using' declaration. Found by clang-tidy: ↵Sylvestre Ledru2017-01-281-1/+0
| | | | | | misc-unused-using-decls NFC llvm-svn: 293380
* COFF: add error() and warn() to Error.{cpp,h}Bob Haarman2017-01-171-1/+6
| | | | | | | | | | | | Summary: This copies over some functionality we have in ELF/Error.{cpp,h} and makes it available in COFF/Error.{cpp,h} Reviewers: pcc, rafael, ruiu Subscribers: Differential Revision: https://reviews.llvm.org/D28692 llvm-svn: 292240
* COFF: Change the /lldmap output format to be more like the ELF linker.Peter Collingbourne2017-01-141-11/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D28717 llvm-svn: 291990
* Rename lld::stringize -> lld::toString.Rui Ueyama2017-01-061-1/+1
| | | | llvm-svn: 291223
* Use TarWriter to create tar archives instead of cpio.Rui Ueyama2017-01-061-14/+19
| | | | | | | | | | This is how we use TarWriter in LLD. Now LLD does not append a file extension, so you need to pass `--reproduce foo.tar` instead of `--reproduce foo`. Differential Revision: https://reviews.llvm.org/D28103 llvm-svn: 291210
* Remove lld/Support/Memory.h.Rui Ueyama2016-12-181-1/+5
| | | | | | | | | | | | I thought for a while about how to remove it, but it looks like we can just copy the file for now. Of course I'm not happy about that, but it's just less than 50 lines of code, and we already have duplicate code in Error.h and some other places. I want to solve them all at once later. Differential Revision: https://reviews.llvm.org/D27819 llvm-svn: 290062
* COFF: Cache the result of library searches.Peter Collingbourne2016-12-161-2/+3
| | | | | | | | | | | | | | | File system operations were still dominating the profile on Windows. In this case we were spending a significant amount of our time repeatedly searching for libraries as a result of processing linker directives. Address this by caching whether we have already found a library with a given name. For chrome_child.dll: Before: 10.53s After: 6.88s Differential Revision: https://reviews.llvm.org/D27840 llvm-svn: 289915
* COFF: Open and map input files asynchronously on Windows.Peter Collingbourne2016-12-151-90/+180
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Profiling revealed that the majority of lld's execution time on Windows was spent opening and mapping input files. We can reduce this cost significantly by performing these operations asynchronously. This change introduces a queue for all operations on input file data. When we discover that we need to load a file (for example, when we find a lazy archive for an undefined symbol, or when we read a linker directive to load a file from disk), the file operation is launched using a future and the symbol resolution operation is enqueued. This implies another change to symbol resolution semantics, but it seems to be harmless ("ninja All" in Chromium still succeeds). To measure the perf impact of this change I linked Chromium's chrome_child.dll with both thin and fat archives. Thin archives: Before (median of 5 runs): 19.50s After: 10.93s Fat archives: Before: 12.00s After: 9.90s On Linux I found that doing this asynchronously had a negative effect on performance, probably because the cost of mapping a file is small enough that it becomes outweighed by the cost of managing the futures. So on non-Windows platforms I use the deferred execution strategy. Differential Revision: https://reviews.llvm.org/D27768 llvm-svn: 289760
* COFF: Load inputs immediately instead of adding them to a queue.Peter Collingbourne2016-12-111-59/+31
| | | | | | | | | | | | This patch replaces the symbol table's object and archive queues, as well as the convergent loop in the linker driver, with a design more similar to the ELF linker where symbol resolution directly causes input files to be added to the link, including input files arising from linker directives. Effectively this removes the last vestiges of the old parallel input file loader. Differential Revision: https://reviews.llvm.org/D27660 llvm-svn: 289409
* Create a TPI stream only when /debugpdb is given.Rui Ueyama2016-12-101-0/+1
| | | | | | | Adding type records to TPI stream is too time consuming. It is reported that linking chrome_child.dll took 5 minutes. llvm-svn: 289330
* COFF: New symbol table design.Peter Collingbourne2016-12-091-7/+7
| | | | | | | | | This ports the ELF linker's symbol table design, introduced in r268178, to the COFF linker. Differential Revision: http://reviews.llvm.org/D21166 llvm-svn: 289280
* COFF: Support both /lldmap and /lldmap:<file>Hans Wennborg2016-12-091-3/+17
| | | | | | | | | | | The former option bases the filename on the output name, e.g. if the link output is a.exe, the map will be written to a.map. This matches the behaviour of link.exe's /MAP option and is useful for creating a map file of each executable when building a large project. Differential Revision: https://reviews.llvm.org/D27595 llvm-svn: 289271
* COFF: Use a string saver in Memory.h in Driver.Rui Ueyama2016-12-081-8/+8
| | | | llvm-svn: 289104
* Remove unnecessary `llvm::`.Rui Ueyama2016-12-081-22/+22
| | | | llvm-svn: 289102
* COFF: Use make() to create a new file object in createFile.Rui Ueyama2016-12-081-6/+6
| | | | llvm-svn: 289097
* Start using make() in COFF (with a smaller change.)Rui Ueyama2016-12-081-4/+3
| | | | llvm-svn: 289089
* Revert r289084: Start using make() in COFF.Rui Ueyama2016-12-081-9/+10
| | | | | | This reverts commit r289084 to appease buildbots. llvm-svn: 289086
* Start using make() in COFF.Rui Ueyama2016-12-081-10/+9
| | | | | | We don't want ELF and COFF to diverge too much. llvm-svn: 289085
* COFF: Define overloaded toString functions.Rui Ueyama2016-12-071-1/+1
| | | | | | | | | | | | | Previously, we had different way to stringize SymbolBody and InputFile to construct error messages. This patch defines overloaded function toString() so that we don't need to memorize all these different function names. With that change, it is now easy to include demangled names in error messages. Now, if there is a symbol name conflict, we'll print out both mangled and demangled names. llvm-svn: 288992
* Style fix.Rui Ueyama2016-11-291-6/+6
| | | | llvm-svn: 288113
* Do plumbing work for CodeView debug info.Rui Ueyama2016-11-211-0/+1
| | | | | | | | | | Previously, we discarded .debug$ sections. This patch adds them to files so that PDB.cpp can access them. This patch also adds a debug option, /dumppdb, to dump debug info fed to createPDB so that we can verify that valid data has been passed. llvm-svn: 287555
* Identify object files compiled with cl.exe /GL.Rui Ueyama2016-11-151-0/+3
| | | | | | | | | | Object files compiled with cl.exe /GL contain intermediate code for LTO. We can't (and don't want to) interpret such code, but we should print out a user-friendly error message. Differential Revision: https://reviews.llvm.org/D26647 llvm-svn: 286921
* Re-submit r283825: Add section header stream to PDB.Rui Ueyama2016-10-111-4/+1
| | | | | | | It was reverted because the change that depends on was reverted. Now it was submitted as r283925, so we can submit this as well. llvm-svn: 283926
* Revert "Add section header stream to PDB." because it depends on r283823.Rui Ueyama2016-10-111-1/+4
| | | | | | The change this patch depends on was reverted. llvm-svn: 283837
* Add section header stream to PDB.Rui Ueyama2016-10-101-4/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D25357 llvm-svn: 283825
* Create PDB.h and move code to remove unnecessary #includes.Rui Ueyama2016-09-151-1/+2
| | | | llvm-svn: 281670
* COFF: add beginnings of debug directory creationSaleem Abdulrasool2016-08-291-4/+6
| | | | | | | | | | The IMAGE_FILE_HEADER structure contains a (RVA, size) to an array of COFF_DEBUG_DIRECTORY records. Each one of these records contains an RVA to a OMF Debug Directory. These OMF debug directories are derived into newer types such as PDB70, PDB20, etc. This constructs a PDB70 structure which will allow us to associate a GUID with a build to actually tie debug information. llvm-svn: 280012
* COFF: handle /debugtype optionSaleem Abdulrasool2016-08-081-1/+29
| | | | | | | | | | Add the support infrastructure for the /debugtype option which takes a comma delimited list of debug info to generate. The defaults are based on other options potentially (/driver or /profile). This sets up the infrastructure to allow us to emit RSDS records to get "build id" equivalents on COFF (similar to binutils). llvm-svn: 278056
* COFF: Implement /linkrepro flag.Peter Collingbourne2016-07-261-0/+53
| | | | | | | | | | | | | | | | This flag is implemented similarly to --reproduce in the ELF linker. This patch implements /linkrepro by moving the cpio writer and associated utility functions to lldCore, and using that implementation in both linkers. One COFF-specific detail is that we store the object file from which the resource files were created in our reproducer, rather than the resource files themselves. This allows the reproducer to be used on non-Windows systems for example. Differential Revision: https://reviews.llvm.org/D22418 llvm-svn: 276719
* COFF: Update error messages so that they start with lowercase letters.Rui Ueyama2016-07-151-3/+3
| | | | llvm-svn: 275513
* Make check() always return a value.Rui Ueyama2016-07-151-4/+2
| | | | | | | Previously, one of two check functions didn't return a value. It was confusing. This patch makes both functions return values. llvm-svn: 275511
* COFF: Remove `void error()` functions and use fatal instead.Rui Ueyama2016-07-151-2/+4
| | | | | | This change makes the control flow more explicit. llvm-svn: 275504
* COFF: Remove unnecessary explicit calls of Twine ctor.Rui Ueyama2016-07-141-4/+4
| | | | llvm-svn: 275501
* COFF: Rename noreturn error -> fatal.Rui Ueyama2016-07-141-12/+12
| | | | | | This new name is also consistent with ELF. llvm-svn: 275500
* COFF: Rename non-noreturn error -> check.Rui Ueyama2016-07-141-2/+2
| | | | | | The new name is consistent with ELF. llvm-svn: 275499
* [COFF] Add /section command line flag.Rui Ueyama2016-06-201-0/+7
| | | | llvm-svn: 273134
* lld-link: Fix default output name with /dll flag.Nico Weber2016-04-201-2/+3
| | | | | | | | If /dll is passed, the default output filename should be foo.dll, not foo.exe. http://reviews.llvm.org/D19321 llvm-svn: 266929
* COFF: Support /manifestinput command line option.Rui Ueyama2016-04-191-0/+4
| | | | | | | | | | | | | | | | | | | Manifest file is a separate or embedded XML file having metadata of an executable. As it is XML, it can contain various types of information. Probably the most popular one is to request escalated priviledges. Usually the linker creates an XML file and embed that file into an executable. However, there's a way to supply an XML file from command line. /manifestniput is it. Apparently it is over-designed here, but if you supply two or more manifest files, then the linker needs to merge the files into a single XML file. A good news is that we don't need to do that ourselves. MT.exe command can do that, so we call the command from the linker in this patch. llvm-svn: 266704
* [coff] Accept and ignore another link.exe flag for compatibilityReid Kleckner2016-03-251-0/+1
| | | | | | | | | | | This flag disables link.exe's crash handler so that normal windows error reporting and crash dumping occurs. For now it is reasonable for LLD to ignore the flag. Chromium is currently using this flag to collect minidumps of link.exe crashing, and it breaks the LLD build. llvm-svn: 264439
* Merge DarwinLdDriver and Driver.Rui Ueyama2016-03-021-0/+1
| | | | | | | | | | | Now that DarwinLdDriver is the only derived class of Driver. This patch merges them and actually removed the class because they can now just be non-member functions. This change simplifies a common header, Driver.h. http://reviews.llvm.org/D17788 llvm-svn: 262502
* Make the entry point function calls consistent. NFC.Rui Ueyama2016-02-281-2/+3
| | | | llvm-svn: 262191
OpenPOWER on IntegriCloud