summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Driver.h
Commit message (Collapse)AuthorAgeFilesLines
...
* Merge DarwinLdDriver and Driver.Rui Ueyama2016-03-021-3/+0
| | | | | | | | | | | 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
* ELF: Add --help option.Rui Ueyama2016-02-281-0/+1
| | | | llvm-svn: 262168
* ELF: Add --version option.Rui Ueyama2016-02-281-0/+2
| | | | llvm-svn: 262167
* Rename elf2 to elf.Rafael Espindola2016-02-281-2/+2
| | | | llvm-svn: 262159
* ELF: Remove readLinkerScript and define LinkerScript::read instead.Rui Ueyama2016-02-111-3/+0
| | | | llvm-svn: 260598
* ELF: Make link() to take an output stream to which error messages are written.Rui Ueyama2016-02-021-1/+2
| | | | | | http://reviews.llvm.org/D16668 llvm-svn: 259597
* Re-submit ELF: Report multiple errors from the driver.Rui Ueyama2016-02-021-0/+1
| | | | | | This reverts r259395 which reverted r259143. llvm-svn: 259572
* Revert r259143, it broke check-lld on Windows (see PR26388).Nico Weber2016-02-011-1/+0
| | | | llvm-svn: 259395
* ELF: Report multiple errors from the driver.Rui Ueyama2016-01-291-0/+1
| | | | | | | | | This patch let the driver keep going until it parses all command line options. http://reviews.llvm.org/D16645 llvm-svn: 259143
* ELF: Rename error -> fatal and redefine error as a non-noreturn function.Rui Ueyama2016-01-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* ELF: Make private functions private.Rui Ueyama2016-01-071-6/+3
| | | | llvm-svn: 257078
* ELF: Split LinkerDriver::createFiles. NFC.Rui Ueyama2016-01-071-0/+1
| | | | | | | createFiles was doing more than creating files despite its name. Now these things are moved to a new function. llvm-svn: 257077
* Simplify --whole-archive handling.Rui Ueyama2016-01-061-1/+0
| | | | | | | | | | | | | | | | | Previously, we handle archive files with --whole-archive this way: create instances of ArchiveFile, call getMembers to obtain memory buffers of archive members, and create ObjectFiles for the members. We didn't call anything except getMembers if --whole-archive was specified. I noticed that we didn't actually have to create ArchiveFile instaces at all for that case. All we need is to get a list of memory buffers for members, which can be done by a non-member function. This patch removes getMembers member function from ArchiveFile. Also removed unnecessary code for memory management. llvm-svn: 256893
* Simplify the InputFile type hierarchy.Rafael Espindola2015-10-121-1/+1
| | | | | | | Now that the SymbolTable is templated, we don't need the ELFData class or multiple inheritance. llvm-svn: 250005
* ELF2: Remove ArgParser class and define parseArgs() function instead.Rui Ueyama2015-10-111-12/+4
| | | | | | | ArgParser was a class with only one member function, so it didn't have to be a class. llvm-svn: 249988
* ELF2: LinkerScript: Interpret -l and = file name prefixes.Rui Ueyama2015-10-111-0/+1
| | | | | | | | In the linker script, -l and = have the same meaning as in the command line. In addition to that, if a path is not absolute, the path needs to be searched from the search paths. This patch implements them. llvm-svn: 249967
* ELF: Move utility functions from Driver to DriverUtils.Rui Ueyama2015-10-111-0/+3
| | | | llvm-svn: 249966
* ELF2: Manage BumpPtrAllocator ownership better.Rui Ueyama2015-10-111-2/+4
| | | | | | | | | | | | Previously, each ArgParser owned a BumpPtrAllocator, and arguments parsed by an ArgParser would refer strings allocated using the BumpPtrAllocator only when response files were used. This could cause a subtle bug because such ownership was not obvious. This patch moves the ownership from ArgParser to Driver and make the ownership explicit. llvm-svn: 249963
* ELF2: Do not leak MemoryBuffers.Rui Ueyama2015-10-111-1/+2
| | | | llvm-svn: 249962
* ELF2: Make SymbolTable a template class.Rui Ueyama2015-10-091-2/+7
| | | | | | | | | | | | | | | | | | | | | | | SymbolTable was not a template class. Instead we had switch-case-based type dispatch to call desired functions. We had to do that because SymbolTable was created before we know what ELF type objects had been passed. Every time I tried to add a new function to the symbol table, I had to define a dispatcher which consist of a single switch statement. It also brought an restriction what the driver can do. For example, we cannot add undefined symbols before any files are added to the symbol table. That's because no symbols can be added until the symbol table knows the ELF type, but when it knows about that, it's too late. In this patch, the driver makes a decision on what ELF type objects are being handled. Then the driver creates a SymbolTable object for an appropriate ELF type. http://reviews.llvm.org/D13544 llvm-svn: 249902
* [ELF2] Handle -m optionDenis Protivensky2015-10-071-0/+3
| | | | | | | | | Parse and apply emulation given with -m option. Check input files to match ELF type and machine architecture provided with -m. Differential Revision: http://reviews.llvm.org/D13055 llvm-svn: 249529
* ELF2: Define Driver::addFile() as a one-stop place to open a file.Rui Ueyama2015-10-011-6/+6
| | | | | | | | | | | | | | Opening a file and dispatching to readLinkerScript() or createFile() is a common operation. We want to use that at least from Driver and from LinkerScript. In COFF, we had the same problem. This patch resolves the problem in the same way as we did for COFF. Now, if you have a path that you want to open, just call Driver->addFile(StringRef). That function opens the file and handles that as if that were given by command line. This function is the only place we call identify_magic(). llvm-svn: 249023
* ELF2: Add basic linker script support.Rui Ueyama2015-09-301-7/+10
| | | | | | | | | | | | | | | | This linker script parser and evaluator is powerful enough to read Linux's libc.so, which is (despite its name) a linker script that contains OUTPUT_FORMAT, GROUP and AS_NEEDED directives. The parser implemented in this patch is a recursive-descendent one. It does *not* construct an AST but consumes directives in place and sets the results to Symtab object, like what Driver is doing. This should be very fast since less objects are allocated, and this is also more readable. http://reviews.llvm.org/D13232 llvm-svn: 248918
* Remove unused declaration and forward declaration.Rui Ueyama2015-09-301-5/+0
| | | | llvm-svn: 248877
* ELF2: Support reponse files.Rui Ueyama2015-09-251-0/+3
| | | | | | http://reviews.llvm.org/D13148 llvm-svn: 248575
* Make these headers as being c++.Rafael Espindola2015-08-141-1/+1
| | | | llvm-svn: 245050
* Move the error handling functions to Error.h. NFC.Rafael Espindola2015-08-061-8/+0
| | | | llvm-svn: 244216
* Create ObjectFile with the correct endian and word size.Rafael Espindola2015-08-041-1/+1
| | | | | | | The writer is still hard coded to 64 bits le, but with this we can test for invalid ELF files. llvm-svn: 243993
* [ELF2] Add a new ELF linker based on the new PE/COFF linker.Michael J. Spencer2015-07-241-0/+67
| | | | | | Differential Revision: http://reviews.llvm.org/D11188 llvm-svn: 243161
* Revert ELF port. Posting to mailing list.Michael J. Spencer2015-07-141-102/+0
| | | | llvm-svn: 242118
* Initial ELF port.Michael J. Spencer2015-07-131-0/+102
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
OpenPOWER on IntegriCloud