summaryrefslogtreecommitdiffstats
path: root/lld/lib/Driver/UniversalDriver.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Move functionality of UniversalDriver to the entry point file.Rui Ueyama2016-02-281-220/+0
| | | | | | | | | | | | | | UniversalDriver was used as a dispatcher to each platform-specific driver. It had its own Options.td file. It was not just too much to parse only a few options (we only want to parse -core, -flavor or argv[0]), but also interpreted arguments too early. For example, if you invoke lld as "lld -flavor gnu ... -help", then you'd get the UniversalDriver's help message instead of GnuDriver's. This patch eliminates the use of Options from the dispatcher. http://reviews.llvm.org/D17686 llvm-svn: 262190
* Rename elf2 to elf.Rafael Espindola2016-02-281-1/+1
| | | | llvm-svn: 262159
* Remove the old ELF linker.Rafael Espindola2016-02-281-4/+0
| | | | | | I think it is clear by now that the new linker is viable. llvm-svn: 262158
* ELF: Make link() to take an output stream to which error messages are written.Rui Ueyama2016-02-021-1/+1
| | | | | | http://reviews.llvm.org/D16668 llvm-svn: 259597
* ELF: Rename error -> fatal and redefine error as a non-noreturn function.Rui Ueyama2016-01-281-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In many situations, we don't want to exit at the first error even in the process model. For example, it is better to report all undefined symbols rather than reporting the first one that the linker picked up randomly. In order to handle such errors, we don't need to wrap everything with ErrorOr (thanks for David Blaikie for pointing this out!) Instead, we can set a flag to record the fact that we found an error and keep it going until it reaches a reasonable checkpoint. This idea should be applicable to other places. For example, we can ignore broken relocations and check for errors after visiting all relocs. In this patch, I rename error to fatal, and introduce another version of error which doesn't call exit. That function instead sets HasError to true. Once HasError becomes true, it stays true, so that we know that there was an error if it is true. I think introducing a non-noreturn error reporting function is by itself a good idea, and it looks to me that this also provides a gradual path towards lld-as-a-library (or at least embed-lld-to-your-program) without sacrificing code readability with lots of ErrorOr's. http://reviews.llvm.org/D16641 llvm-svn: 259069
* Rename ld.lld2 to ld.lld since it is the default.Rafael Espindola2015-11-181-1/+1
| | | | llvm-svn: 253437
* Make ELF2 the default.Rafael Espindola2015-11-171-2/+2
| | | | | | With this the only way to get the old elf linker is "-flavor old-elf". llvm-svn: 253318
* Rename gnu2 to gnu.Rafael Espindola2015-11-161-4/+4
| | | | | | This is the second step in making ELF2 the default. llvm-svn: 253270
* Rename the gnu flavour to gnu old.Rafael Espindola2015-11-161-9/+9
| | | | | | This is the first step in making ELF2 the default. llvm-svn: 253188
* Update lld to match llvm r250901. OptTable constructor now takes an ↵Craig Topper2015-10-211-1/+1
| | | | | | ArrayRef. NFC llvm-svn: 250904
* Use ld.lld2 as a argv[0] alias.Rafael Espindola2015-10-021-1/+4
| | | | | | | | The reason for the name is so that we can run ./build/bin/clang -fuse-ld=lld2 test.o -o t llvm-svn: 249122
* COFF: Remove lld-link2 alias.Rui Ueyama2015-08-071-2/+0
| | | | llvm-svn: 244358
* COFF: Remove the old COFF linker and make link an alias to link2.Rui Ueyama2015-08-061-5/+2
| | | | | | It's time to remove old COFF linker because the new one is now complete. llvm-svn: 244226
* Port the error functions from ELF to COFF.Rafael Espindola2015-08-061-1/+2
| | | | | | | | | | | | | | | This has a few advantages * Less C++ code (about 300 lines less). * Less machine code (about 14 KB of text on a linux x86_64 build). * It is more debugger friendly. Just set a breakpoint on the exit function and you get the complete lld stack trace of when the error was found. * It is a more robust API. The errors are handled early and we don't get a std::error_code hot potato being passed around. * In most cases the error function in a better position to print diagnostics (it has more context). llvm-svn: 244215
* [ELF2] Add a new ELF linker based on the new PE/COFF linker.Michael J. Spencer2015-07-241-0/+5
| | | | | | Differential Revision: http://reviews.llvm.org/D11188 llvm-svn: 243161
* Revert ELF port. Posting to mailing list.Michael J. Spencer2015-07-141-4/+0
| | | | llvm-svn: 242118
* Initial ELF port.Michael J. Spencer2015-07-131-0/+4
| | | | | | | | This is a direct port of the new PE/COFF linker to ELF. It can take a single object file and generate a valid executable that executes at the first byte in the text section. llvm-svn: 242088
* Update for LLVM API change to return by InputArgList directly (rather than ↵David Blaikie2015-06-221-8/+8
| | | | | | by pointer) from ParseArgs llvm-svn: 240347
* Fix missed formatting in prior commit (mostly 80 cols violation and some ↵David Blaikie2015-06-221-5/+5
| | | | | | whitespace around *) llvm-svn: 240346
* ArrayRef-ify Driver::parse and related functions.David Blaikie2015-06-211-20/+18
| | | | llvm-svn: 240236
* ArrayRef-ify ParseArgsDavid Blaikie2015-06-211-2/+2
| | | | llvm-svn: 240235
* COFF: Add a new PE/COFF port.Rui Ueyama2015-05-281-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an initial patch for a section-based COFF linker. The patch has 2300 lines of code including comments and blank lines. Before diving into details, you want to start from reading README because it should give you an overview of the design. All important things are written in the README file, so I write summary here. - The linker is already able to self-link on Windows. - It's significantly faster than the existing implementation. The existing one takes 5 seconds to link LLD on my machine, while the new one only takes 1.2 seconds, even though the new one is not multi-threaded yet. (And a proof-of-concept multi- threaded version was able to link it in 0.5 seconds.) - It uses much less memory (250MB vs. 2GB virtual memory space to self-host). - IMHO the new code is much simpler and easier to read than the existing PE/COFF port. http://reviews.llvm.org/D10036 llvm-svn: 238458
* Sort include files according to convention.Shankar Easwaran2014-10-181-2/+0
| | | | llvm-svn: 220131
* Fix typo in commentRui Ueyama2014-10-081-1/+1
| | | | llvm-svn: 219326
* Add support to print version.Shankar Easwaran2014-10-081-0/+8
| | | | | | | | | | | | | | | | | | | Summary: Add support in the universal driver to print the lld version and the repository version. Test Plan: A driver test is added Reviewers: kledzik, ruiu Reviewed By: ruiu Subscribers: llvm-commits Projects: #lld Differential Revision: http://reviews.llvm.org/D5641 llvm-svn: 219277
* Make -core/-flavor options have higher priority than linker nameRui Ueyama2014-09-231-16/+26
| | | | | | | | | Also allows -core/flavor to appear at any position in the command line. Patch from Oleg Ranevskyy! http://reviews.llvm.org/D5384 llvm-svn: 218321
* Make getFlavor function.Rui Ueyama2014-09-111-24/+28
| | | | | | | The dangling "else" at the end of #if looked a bit error-prone. Make it a separate function. No functionality change. llvm-svn: 217568
* If lld is renamed (or symlinked) to "ld" automatically pick the right flavor.Nick Kledzik2014-09-111-6/+11
| | | | | | | | | | | | | The existing system linkers on Darwin and Linux are called "ld". We'd like to eventually drop in lld as "ld" and have it just work. But lld is a universal linker that requires the first option to be -flavor to know which command line mode to emulate (gnu or darwin). This change tests if argv[0] is "ld" and if so, if the tool was built on MacOSX then assume the darwin flavor otherwise the gnu flavor. There are two test cases which copy lld to "ld" and then run it. One for darwin and one for linux. llvm-svn: 217566
* If lld binary is named 'ld' on darwin, use darwin driver modeNick Kledzik2014-09-041-1/+7
| | | | llvm-svn: 217112
* Add missing includes.Benjamin Kramer2014-04-121-0/+1
| | | | llvm-svn: 206113
* Make anonymous namespace as small as possible.Rui Ueyama2014-03-271-14/+16
| | | | llvm-svn: 204982
* [PECOFF] Rename link.exe -> lld-link.exe.Rui Ueyama2014-03-211-0/+1
| | | | | | | Creating the file "link.exe" made some confusion, so it's better to name it lld-link.exe, as we did for CL (clang-cl.exe). llvm-svn: 204509
* [Driver] Change UniversalDriver to use TD file.Shankar Easwaran2013-10-241-32/+79
| | | | | | | | Easier to add new options such as -version, and easy to parse. Now displays a help message with -help llvm-svn: 193301
* Make Driver::link and LinkingContext::validate return true on success.Rui Ueyama2013-09-241-1/+1
| | | | | | | | | | | | | This patch inverts the return value of these functions, so that they return "true" on success and "false" on failure. The meaning of boolean return value was mixed in LLD; for example, InputGraph::validate() returns true on success. With this patch they'll become consistent. CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1748 llvm-svn: 191341
* Revert "Don't pass llvm::errs() all over the place. Diagnostics always go to ↵Rafael Espindola2013-07-151-11/+12
| | | | | | | | stderr." This reverts commit 185657. It will be used by unit tests. llvm-svn: 186366
* Don't pass llvm::errs() all over the place. Diagnostics always go to stderr.Rafael Espindola2013-07-041-12/+11
| | | | llvm-svn: 185657
* [lld][PECOFF] Add WinLinkDriver and PECOFFTargetInfo.Rui Ueyama2013-05-281-3/+3
| | | | | | | | | | | | | | Add WinLinkDriver and connect it to the existing COFF reader. Remaining parts are still stubs, so while it can now read a COFF file, it still cannot link or output PE/COFF files yet. Reviewers: Bigcheese CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D865 llvm-svn: 182784
* [lld] Add help text for -flavor option.Rui Ueyama2013-05-111-1/+2
| | | | llvm-svn: 181655
* [lld] Fix wrong comment.Rui Ueyama2013-05-091-1/+2
| | | | llvm-svn: 181547
* Distinguish between unsupported and unrecognised flavours.Andy Gibbs2013-04-161-2/+2
| | | | | | Suggested by Nick Kledzik in reference to r179590. llvm-svn: 179617
* Moved llvm_unreachable out of switch blocks to avoid the "control reaches ↵Andy Gibbs2013-04-161-1/+2
| | | | | | end of non-void function" warning. llvm-svn: 179590
* [Driver] Fix symlinked universal driver behavior and add a test.Michael J. Spencer2013-04-041-60/+84
| | | | llvm-svn: 178798
* This is my Driver refactoring patch. Nick Kledzik2013-04-041-0/+109
The major changes are: 1) LinkerOptions has been merged into TargetInfo 2) LinkerInvocation has been merged into Driver 3) Drivers no longer convert arguments into an intermediate (core) argument list, but instead create a TargetInfo object and call setter methods on it. This is only how in-process linking would work. That is, you can programmatically set up a TargetInfo object which controls the linking. 4) Lots of tweaks to test suite to work with driver changes 5) Add the DarwinDriver 6) I heavily doxygen commented TargetInfo.h Things to do after this patch is committed: a) Consider renaming TargetInfo, given its new roll. b) Consider pulling the list of input files out of TargetInfo. This will enable in-process clients to create one TargetInfo the re-use it with different input file lists. c) Work out a way for Drivers to format the warnings and error done in core linking. llvm-svn: 178776
OpenPOWER on IntegriCloud