summaryrefslogtreecommitdiffstats
path: root/lld/COFF/DriverUtils.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [lld] unified COFF and ELF error handling on new Common/ErrorHandlerBob Haarman2017-10-251-11/+13
| | | | | | | | | | | | | | | | | | | Summary: The COFF linker and the ELF linker have long had similar but separate Error.h and Error.cpp files to implement error handling. This change introduces new error handling code in Common/ErrorHandler.h, changes the COFF and ELF linkers to use it, and removes the old, separate implementations. Reviewers: ruiu Reviewed By: ruiu Subscribers: smeenai, jyknight, emaste, sdardis, nemanjai, nhaehnle, mgorny, javed.absar, kbarton, fedor.sergeev, llvm-commits Differential Revision: https://reviews.llvm.org/D39259 llvm-svn: 316624
* [COFF] Add support for /WXShoaib Meenai2017-10-241-0/+3
| | | | | | | | | link.exe supports this option to convert warnings into errors, and it's useful to support in LLD as well. Differential Revision: https://reviews.llvm.org/D39148 llvm-svn: 316502
* COFF: Add resource files to linkrepro instead of the cvtres object file.Peter Collingbourne2017-10-161-5/+6
| | | | | | | | | Now that we have our own implementation of cvtres, we can add resource files directly to the linkrepro. Differential Revision: https://reviews.llvm.org/D38974 llvm-svn: 315954
* COFF: Give manifest resource file a name.Peter Collingbourne2017-10-161-1/+2
| | | | | | | | | | | Without this, /linkrepro would create an invalid tar file. No tests because this requires Windows and the linkrepro tests require not-Windows. Differential Revision: https://reviews.llvm.org/D38973 llvm-svn: 315948
* Fix crbug 759265 by suppressing llvm mt warnings.Eric Beckmann2017-09-061-32/+14
| | | | | | | | | | | | Summary: Previous would throw warning whenever libxml2 is not installed. Now only give this warning if merging manifest fails. Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D37240 llvm-svn: 312604
* lld-link: Add --rsp-quoting= flag.Nico Weber2017-09-051-22/+31
| | | | | | | | | | This ports https://reviews.llvm.org/D19425 from clang / https://reviews.llvm.org/D22015 from the ELF port to COFF lld. This can be useful when linking COFF files on a posix host. https://reviews.llvm.org/D37452 llvm-svn: 312594
* Use raw_string_ostream::str to get a result string.Rui Ueyama2017-09-051-1/+1
| | | | | | | | | | | Looks like raw_string_ostream is buffered. If we do not call `flush` nor `str`, it is not guaranteed that a result string has all characters that were written to it. It wasn't failing on buildbots, but I could reproduce the issue on my Windows workstation. llvm-svn: 312577
* Keep an instance of COFFOptTable alive as long as InputArgList is alive.Rui Ueyama2017-08-281-5/+1
| | | | | | | | | | | | | | | | | | | | | | Summary: ArgParser created an instance of COFFOptTable on stack to use it to parser command line arguments. Parsed arguments were then returned from the function as InputArgList. This was safe because InputArgList referred only statically-allocated InfoTable. That is not a safe assumption after https://reviews.llvm.org/D36782, which changes the type of its internal table from ArrayRef to std::vector. To make lld work with that patch, we need to keep an instance of COFFOptTable at least as long as an InputArgList is alive. This patch does that. Reviewers: yamaguchi Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D37217 llvm-svn: 311930
* NFC: LLD fix OptTable Variable Name StyleMartell Malone2017-08-231-2/+2
| | | | llvm-svn: 311518
* Fix a -Wpessimizing-move warning from Clang on this code --Chandler Carruth2017-08-221-1/+1
| | | | | | a std::move() isn't needed here as the object is a temporary. llvm-svn: 311430
* Integrate manifest merging library into LLD.Eric Beckmann2017-08-221-27/+68
| | | | | | | | | | Summary: Now that the llvm-mt manifest merging libraries are complete, we may use them to merge manifests instead of needing to shell out to mt.exe. Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D36255 llvm-svn: 311424
* [COFF] Add support for aligncomm directivesMartin Storsjo2017-08-141-0/+16
| | | | | | | | | | | | | | These are emitted for comm symbols in object files, when targeting a GNU environment. Alternatively, just ignore them since we already align CommonChunk to the natural size of the content (up to 32 bytes). That would only trade away the possibility to overalign small symbols, which doesn't sound like something that might not need to be handled? Differential Revision: https://reviews.llvm.org/D36304 llvm-svn: 310871
* lld: /manifestuac:no shouldn't disable /manifestdependency:Nico Weber2017-07-261-7/+7
| | | | | | | Matches link.exe https://reviews.llvm.org/D35872 llvm-svn: 309231
* Use StringRef::contains().Rui Ueyama2017-07-191-2/+2
| | | | llvm-svn: 308526
* Revert "Revert "Revert "Revert "Switch external cvtres.exe for llvm's own ↵Eric Beckmann2017-07-081-79/+71
| | | | | | | | | | | | | | | | | | | | resource library."""" This reverts commit 147f45ff24456aea59575fa4ac16c8fa554df46a. Revert "Revert "Revert "Revert "Replace trivial use of external rc.exe by writing our own .res file."""" This reverts commit 61a90a67ed54a1f0dfeab457b65abffa129569e4. The patches were intially reverted because they were causing a failure on CrWinClangLLD. Unfortunately, this was done haphazardly and didn't compile, so the revert was reverted again quickly to fix this. One that was done, the revert of the revert was itself reverted. This allowed me to finally fix the actual bug in r307452. This patch re-enables the code path that had originally been causing the bug, now that it (should) be fixed. llvm-svn: 307460
* Revert "Revert "Revert "Switch external cvtres.exe for llvm's own resource ↵Eric Beckmann2017-07-051-13/+30
| | | | | | | | | | | | | | library.""" This reverts commit ae21ee0b6cacbc1efaf4d42502e71da2f0eb45c3. The initial revert was done in order to prevent ongoing errors on chromium bots such as CrWinClangLLD. However, this was done haphazardly and I didn't realize there were test and compilation failures, so this revert was reverted. Now that those have been fixed, we can revert the revert of the revert. llvm-svn: 307227
* Revert "Revert "Revert "Replace trivial use of external rc.exe by writing ↵Eric Beckmann2017-07-051-60/+49
| | | | | | | | | | | | | | our own .res file.""" This reverts commit 5fecbbbe5049665d86834cf69d8f75db4f392308. The initial revert was done in order to prevent ongoing errors on chromium bots such as CrWinClangLLD. However, this was done haphazardly and I didn't realize there were test and compilation failures, so this revert was reverted. Now that those have been fixed, we can revert the revert of the revert. llvm-svn: 307226
* Revert "Revert "Replace trivial use of external rc.exe by writing our own ↵Eric Beckmann2017-07-051-49/+60
| | | | | | | | .res file."" This reverts commit 8c8dce3b8f15d6ebaefc35ce88f15a85c8cdbd6e. llvm-svn: 307191
* Revert "Revert "Switch external cvtres.exe for llvm's own resource library.""Eric Beckmann2017-07-051-30/+13
| | | | | | | | This reverts commit 165e578e47f1cd38191120aad23a9020fb5476dd. Forgot to run tests on this. llvm-svn: 307190
* Revert "Switch external cvtres.exe for llvm's own resource library."Eric Beckmann2017-07-051-13/+30
| | | | | | | | | This reverts commit 600d52c278e123dd08bee24c1f00932b55add8de. This patch still seems to break CrWinClangLLD, reverting until I can find root problem. llvm-svn: 307189
* Revert "Replace trivial use of external rc.exe by writing our own .res file."Eric Beckmann2017-07-051-60/+49
| | | | | | | | | This patch still seems to break CrWinClangLLD, reverting this once more until I can discover root problem. This reverts commit 3dbbc8ce43be50ffde2b1c655c6d3a25796fe78b. llvm-svn: 307188
* [COFF] Add initial support for linking ARM64 binariesMartin Storsjo2017-07-011-0/+3
| | | | | | | | | A plain empty entry point function that returns 0 seems to produce a binary that loads and runs fine in wine. Differential Revision: https://reviews.llvm.org/D34833 llvm-svn: 306963
* Revert "Revert "Replace trivial use of external rc.exe by writing our own ↵Eric Beckmann2017-07-011-79/+73
| | | | | | | | | | | | | | | | | | .res file."" Summary: This reverts commit 51931072a7c9a52540baf76fc30ef391d2529a2f. This revert was originally done because the integrations of the new WindowsResource library into LLD was causing error in chromium, due to bugs in how resource sections were handled. These bugs were fixed, meaning that the features may be reintegrated. Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D34922 llvm-svn: 306941
* Revert "Replace trivial use of external rc.exe by writing our own .res file."Eric Beckmann2017-06-291-73/+79
| | | | | | | | | | | | | | | This reverts commit d4c7e9fc63c10dbab0c30186ef8575474a704496. This is done in order to address the failure of CrWinClangLLD etc. bots. These throw an error of "side-by-side configuration is incorrect" during compilation, which sounds suspiciously related to these manifest changes. Revert "Switch external cvtres.exe for llvm's own resource library." This reverts commit 71fe8ef283a9dab9a3f21432c98466cbc23990d1. llvm-svn: 306618
* Fix -Wpessimizing-move.Rui Ueyama2017-06-261-1/+1
| | | | llvm-svn: 306323
* Replace trivial use of external rc.exe by writing our own .res file.Eric Beckmann2017-06-261-49/+60
| | | | | | | | | This patch removes the dependency on the external rc.exe tool by writing a simple .res file using our own library. In this patch I also added an explicit definition for the .res file magic. Furthermore, I added a unittest for embeded manifests and fixed a bug exposed by the test. llvm-svn: 306311
* Fix argument numbersing in OPTION macroSam Clegg2017-06-201-3/+3
| | | | | | | | | | The option numbers in the macro were off by one which leads to some confusion. There are actually 12 arguments to this macro. Differential Revision: https://reviews.llvm.org/D34413 llvm-svn: 305823
* [GSoC] Flag value completion for clangYuka Takahashi2017-06-201-5/+3
| | | | | | | | | | | | This is patch for GSoC project, bash-completion for clang. To use this on bash, please run `source clang/utils/bash-autocomplete.sh`. bash-autocomplete.sh is code for bash-completion. In this patch, Options.td was mainly changed in order to add value class in Options.inc. llvm-svn: 305805
* Have writeCOFFWriter return Expected<unique_ptr>.Eric Beckmann2017-06-191-6/+5
| | | | | | | | | | | | Summary: Have writeCOFFWriter return Expected<unique_ptr> instead of requiring being passed an uninitialized unique_ptr. Reviewers: zturner, ruiu Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D34307 llvm-svn: 305730
* Switch external cvtres.exe for llvm's own resource library.Eric Beckmann2017-06-161-30/+14
| | | | | | | | | | | | | | | | | | | | | | | | In this patch, I flip the switch in DriverUtils from using the external cvtres.exe tool to using the Windows Resource library in llvm. I also fixed a bug where .rsrc sections were marked as discardable memory and therefore were placed in the wrong order in the final PE. Furthermore, I modified WindowsResource to write the coff directly to a memory buffer instead of to file, also had it use the machine types already declared in COFF.h instead creating my own enum. Finally, I flipped the switch to allow all unit tests that had previously run only on windows due to a winres dependency to run cross-platform. Reviewers: zturner, ruiu Subscribers: llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D34265 llvm-svn: 305592
* COFF: add support for lib mode usageSaleem Abdulrasool2017-06-151-1/+1
| | | | | | | | | | When link is invoked with `/def:` and no input files, it behaves as if `lib.exe` was invoked. Emulate this behaviour, generating the import library from the def file that was passed. Because there is no input to actually generate the dll, we simply process the def file early and exit once we have created the import library. llvm-svn: 305502
* Use make<> everywhere in COFF to make it consistent with ELF.Rui Ueyama2017-05-181-3/+1
| | | | | | | | | We've been using make<> to allocate new objects in ELF. We have the same function in COFF, but we didn't use it widely due to negligence. This patch uses the function in COFF to close the gap between ELF and COFF. llvm-svn: 303357
* Handle _LINK_ env string as command line parameters.Rui Ueyama2017-04-241-10/+13
| | | | | | | | | "_LINK_" environment varaible should be appended to the command line. https://msdn.microsoft.com/en-us/library/6y6t9esh.aspx Fixes https://bugs.llvm.org/show_bug.cgi?id=32756 llvm-svn: 301264
* COFF: add support for CONSTANT exportsSaleem Abdulrasool2017-04-211-0/+4
| | | | | | | | 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
* [coff] use newlines instead of spaces as separators in msvclto response fileBob Haarman2017-04-181-1/+1
| | | | | | | | | | | | | | Summary: Fixes PR32689: /msvclto creates response files with lines that are too long for msvc's linker (LNK1170). Reviewers: hans, rnk, ruiu Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D32185 llvm-svn: 300612
* Fix /msvclto.Rui Ueyama2017-02-231-36/+3
| | | | | | | Previously, bitcode files in library paths were passed to the MSVC linker. This patch strips them. llvm-svn: 295913
* Attempt to fix buildbot.Rui Ueyama2017-02-221-2/+0
| | | | | | | | I added this log message to test the /msvclto option, but this output might confuse FileCheck. This patch attempts to fix it by removing it. llvm-svn: 295793
* Do not use errs() or outs() directly. Instead use message(), log() or error()Rui Ueyama2017-02-211-29/+23
| | | | | | | | | 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
* Add an option to use the MSVC linker to link LTO-generated object files.Rui Ueyama2017-02-061-1/+71
| | | | | | | | | | | 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
* Remove lld/Support/Memory.h.Rui Ueyama2016-12-181-1/+1
| | | | | | | | | | | | 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: Fix test failure on Windows.Peter Collingbourne2016-12-091-4/+6
| | | | llvm-svn: 289289
* COFF: New symbol table design.Peter Collingbourne2016-12-091-5/+5
| | | | | | | | | 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: Use a string saver in Memory.h in Driver.Rui Ueyama2016-12-081-2/+1
| | | | llvm-svn: 289104
* Remove unnecessary `llvm::`.Rui Ueyama2016-12-081-22/+21
| | | | llvm-svn: 289102
* Simplify "missing argument" error message.Rui Ueyama2016-11-291-3/+1
| | | | llvm-svn: 288112
* Add comments.Rui Ueyama2016-11-291-1/+4
| | | | llvm-svn: 288111
* [COFF] Fix manifest resource file creation on Windows.Rui Ueyama2016-11-151-2/+23
| | | | | | | | | | | | | | | createManifestRes was generating a MemoryBuffer from a TemporaryFile, keeping the data but removing the file, before passing the file path to CVTRES.exe, leading to the following error: CVTRES : fatal error CVT1101: cannot open 'C:\Users\user\AppData\ Local\Temp\lld-output-resource-bfee19.res' for reading With this, we instead create a new TemporaryFile before passing it to cvtres. Patch from Rudy Pons! llvm-svn: 287034
* Use StringRef in StringSaver API (NFC)Mehdi Amini2016-10-051-5/+5
| | | | llvm-svn: 283290
* Use StringSwtich::Cases for multiple choices.Rui Ueyama2016-09-301-4/+2
| | | | llvm-svn: 282964
* Remove temoprary files.Rui Ueyama2016-09-021-36/+60
| | | | | | | | | | | | | | Previously, we created temporary files using llvm::sys::fs::createTemporaryFile and removed them using llvm::FileRemover. This is error-prone as it is easy to forget creating FileRemover instances after creating temporary files. There is actually a temporary file leak bug. This patch introduces a new class, TemporaryFile, to manage temporary files in the RAII style. Differential Revision: https://reviews.llvm.org/D24176 llvm-svn: 280510
OpenPOWER on IntegriCloud