summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/ELF
Commit message (Collapse)AuthorAgeFilesLines
...
* Run the resolver in parallel with the reader.Rui Ueyama2015-01-161-1/+3
| | | | | | | | | | | | | | | | | | | | This patch makes File::parse() multi-thread safe. If one thread is running File::parse(), other threads will block if they try to call the same method. File::parse() is idempotent, so you can safely call multiple times. With this change, we don't have to wait for all worker threads to finish in Driver::link(). Previously, Driver::link() calls TaskGroup::sync() to wait for all threads running File::parse(). This was not ideal because we couldn't start the resolver until we parse all files. This patch increase parallelism by making Driver::link() to not wait for worker threads. The resolver calls parse() to make sure that the file being read has been parsed, and then uses the file. In this approach, the resolver can run with the parser threads in parallel. http://reviews.llvm.org/D6994 llvm-svn: 226281
* [ELF] Add --as-needed.Rui Ueyama2015-01-162-0/+22
| | | | | | | | | | | | The previous default behavior of LLD is --as-needed. LLD linked against a DSO only if the DSO file was actually used to link an executable (i.e. at least one symbol was resolved using the shared library file.) In this patch I added a boolean flag to FileNode for --as-needed. I also added an accessor to DSO name to shared library file class. llvm-svn: 226274
* [ELF] Remove TargetHandler and DefaultTargetHandler constructorsSimon Atanasyan2015-01-168-21/+12
| | | | | | | These classes contain only abstract virtual functions. Explicit constructors are redundant. llvm-svn: 226265
* [ELF] Remove unused class fieldSimon Atanasyan2015-01-161-5/+1
| | | | | | No functional changes. llvm-svn: 226262
* [ELF] s/_context/_ctx/ and clang-format the codeSimon Atanasyan2015-01-161-9/+6
| | | | | | No functional changes. llvm-svn: 226261
* [ELF] Make the unhandledReferenceType() protected methodSimon Atanasyan2015-01-161-1/+2
| | | | | | No functional changes. llvm-svn: 226260
* [ELF] Make `TargetRelocationHandler` a regular non-template classSimon Atanasyan2015-01-169-26/+17
| | | | | | | This class defines a relocation handler interface. The interface does not depend on the template argument so the argument is redundant. llvm-svn: 226259
* [PPC] Remove redundant `virtual` keywordSimon Atanasyan2015-01-161-3/+3
| | | | | | No functional changes. llvm-svn: 226258
* [PPC] Remove unused class field PPCTargetRelocationHandler::_ppcTargetLayoutSimon Atanasyan2015-01-162-9/+3
| | | | | | No functional changes. llvm-svn: 226257
* [Mips] Use ELFLinkingContext class instead of MipsLinkingContext where possibleSimon Atanasyan2015-01-164-15/+12
| | | | | | No functional changes. llvm-svn: 226256
* [Mips] Make MipsLinkingContext owner of MipsELFFlagsMergerSimon Atanasyan2015-01-168-41/+32
| | | | | | | That reduce class dependencies and simplify the code a bit. No functional changes. llvm-svn: 226255
* [Mips] Remove redundant namespace namesSimon Atanasyan2015-01-161-29/+27
| | | | | | No functional changes. llvm-svn: 226254
* [Mips] Allow linking object files with MIPS32 and MIPS64 instructionsSimon Atanasyan2015-01-161-4/+56
| | | | | | | If object files satisfy O32 ABI they can be linked together even if some of them contains MIPS64 or MIPS64R2 instructions. llvm-svn: 226253
* Re-commit r225674: Convert other drivers to use WrapperNode.Rui Ueyama2015-01-152-10/+10
| | | | | | | | The original commit had an issue with Mac OS dylib files. It didn't handle fat binary dylib files correctly. This patch includes a fix. A test for that case has already been committed in r225764. llvm-svn: 226123
* [cleanup] Re-sort #include lines using llvm/utils/sort_includes.pyChandler Carruth2015-01-141-1/+1
| | | | | | | | This is just a mechanical cleanup, no functionality changed. This just fixes very minor inconsistencies with how #include lines were spaced and sorted in LLD. llvm-svn: 225978
* Revert "Convert other drivers to use WrapperNode" and subsequent commits.Rui Ueyama2015-01-142-10/+10
| | | | | | | r225764 broke a basic functionality on Mac OS. This change reverts r225764, r225766, r225767, r225769, r225814, r225816, r225829, and r225832. llvm-svn: 225859
* Convert other drivers to use WrapperNode.Rui Ueyama2015-01-132-10/+10
| | | | llvm-svn: 225764
* [Mips] Replace stderr output by the `llvm_unreachable` callSimon Atanasyan2014-12-251-4/+4
| | | | | | | | | If a regular symbol has microMIPS-bit we need to stop linking. Now the LLD does not check the `applyRelocation` return value and continues linking anyway. As a temporary workaround use the `llvm_unreachable` call to stop the linker. llvm-svn: 224831
* [Mips] Support linking of microMIPS 32-bit codeSimon Atanasyan2014-12-247-84/+530
| | | | | | | The change is rather large but mainly it just adds handling of new relocations, PLT entries etc. llvm-svn: 224826
* [Mips] Join two if statementsSimon Atanasyan2014-12-241-3/+1
| | | | | | No functional changes. llvm-svn: 224817
* [Mips] Make the comment more descriptiveSimon Atanasyan2014-12-241-1/+1
| | | | | | No functional changes. llvm-svn: 224816
* [Mips] Factor out the code checks a symbol's bindingSimon Atanasyan2014-12-241-5/+6
| | | | | | No functional changes. llvm-svn: 224815
* [Mips] Rename the function s/readAddend/getAddend/Simon Atanasyan2014-12-241-4/+4
| | | | | | No functional changes. llvm-svn: 224814
* [Mips] Use OR operation to set the microMIPS bitSimon Atanasyan2014-12-242-2/+2
| | | | llvm-svn: 224813
* Protect doParse() because that's not a public interface.Rui Ueyama2014-12-153-2/+4
| | | | llvm-svn: 224235
* Make File always take the ownership of a MemoryBuffer.Rui Ueyama2014-12-122-6/+6
| | | | | | | | | | | | | | The documentation of parseFile() said that "the resulting File object may take ownership of the MemoryBuffer." So, whether or not the ownership of a MemoryBuffer would be taken was not clear. A FileNode (a subclass of InputElement, which is being deprecated) keeps the ownership if a File doesn't take it. This patch makes File always take the ownership of a buffer. Buffers lifespan is not always the same as File instances. Files are able to deallocate buffers after parsing the contents. llvm-svn: 224113
* Separate file parsing from File's constructors.Rui Ueyama2014-12-128-78/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a second patch for InputGraph cleanup. Sorry about the size of the patch, but what I did in this patch is basically moving code from constructor to a new method, parse(), so the amount of new code is small. This has no change in functionality. We've discussed the issue that we have too many classes to represent a concept of "file". We have File subclasses that represent files read from disk. In addition to that, we have bunch of InputElement subclasses (that are part of InputGraph) that represent command line arguments for input file names. InputElement is a wrapper for File. InputElement has parseFile method. The method instantiates a File. The File's constructor reads a file from disk and parses that. Because parseFile method is called from multiple worker threads, file parsing is processed in parallel. In other words, one reason why we needed the wrapper classes is because a File would start reading a file as soon as it is instantiated. So, the reason why we have too many classes here is at least partly because of the design flaw of File class. Just like threads in a good threading library, we need to separate instantiation from "start" method, so that we can instantiate File objects when we need them (which should be very fast because it involves only one mmap() and no real file IO) and use them directly instead of the wrapper classes. Later, we call parse() on each file in parallel to let them do actual file IO. In this design, we can eliminate a reason to have the wrapper classes. In order to minimize the size of the patch, I didn't go so far as to replace the wrapper classes with File classes. The wrapper classes are still there. In this patch, we call parse() immediately after instantiating a File, so this really has no change in functionality. Eventually the call of parse() should be moved to Driver::link(). That'll be done in another patch. llvm-svn: 224102
* [ELF] Remove isThumb().Shankar Easwaran2014-12-121-2/+0
| | | | llvm-svn: 224099
* [ELF] Remove duplicate constructor code.Rui Ueyama2014-12-116-182/+52
| | | | | | This piece of code was copied multiple times to each archs. llvm-svn: 224001
* [ELF] Allow target to adjust a symbol's value for using in a dynamic tagSimon Atanasyan2014-12-102-2/+20
| | | | | | | | | Some targets like microMIPS and ARM Thumb use the last bit of a symbol's value to mark 'compressed' code. This patch adds new virtual function `DynamicTable::getAtomVirtualAddress` which allows to adjust a symbol's value before using it in a dynamic table tags like DT_INIT / DT_FINI. llvm-svn: 223963
* [ELF] Make -init/-fini options compatible with the gnu linkerSimon Atanasyan2014-12-108-281/+29
| | | | | | | | | | | | | | The LLD linker searches initializer and finalizer function names and emits DT_INIT/DT_FINI dynamic table tags to point to these symbols. The -init/-fini command line options override initializer ("_init") and finalizer ("_fini") function names used by default. Now the -init/-fini options do not affect .init_array/.fini_array sections. The corresponding code has been removed. Differential Revision: http://reviews.llvm.org/D6578 llvm-svn: 223917
* Fix the MSVC buildHans Wennborg2014-12-092-2/+4
| | | | llvm-svn: 223796
* ELF: Add a standard method for unknown relocation errorsWill Newton2014-12-0919-64/+63
| | | | | | | | | | | | | | | | | | | At present each TargetRelocationHandler generates a pretty similar error string and calls llvm_unreachable() when encountering an unknown relocation. This is not ideal for two reasons: 1. llvm_unreachable disappears in release builds but we still want to know if we encountered a relocation we couldn't handle in release builds. 2. Duplication is bad - there is no need to have a per-architecture error message. This change adds a test for AArch64 to test whether or not the error message actually works. The other architectures have not been tested but they compile and check-lld passes. llvm-svn: 223782
* ELF: Use ELF reloc .def files to reduce duplicationWill Newton2014-12-056-330/+32
| | | | | | Tested with check-lld with no regressions. llvm-svn: 223462
* Fix a bunch of -Winconsistent-missing-override warnings.Eric Christopher2014-12-041-7/+7
| | | | llvm-svn: 223400
* [ELF] Adjust ELF header entry symbol value if this symbol is microMIPS encodedSimon Atanasyan2014-12-045-25/+39
| | | | | | | To find an AtomLayout object for the given symbol I replace the `Layout::findAtomAddrByName` method by `Layout::findAtomLayoutByName` method. llvm-svn: 223359
* [ELF] Fix layout of output sections.Shankar Easwaran2014-11-301-2/+6
| | | | | | | | | The AtomSections were improperly merging sections from various input files. This patch fixes the problem, with an updated test that was provided by Simon. Thanks to Simon Atanasyan for catching this issue. llvm-svn: 222982
* [ELF] Rename align2 to alignment.Shankar Easwaran2014-11-307-61/+61
| | | | | | No change in functionality. llvm-svn: 222975
* [ELF] Fix creation of segments.Shankar Easwaran2014-11-301-3/+15
| | | | | | | Linker was creating a separate output segment in some cases if input sections had huge alignments. This patch fixes the issue. llvm-svn: 222974
* [ELF] Create input and output section namesShankar Easwaran2014-11-305-26/+58
| | | | | | No change in functionality. llvm-svn: 222973
* [ELF] Rename MergedSection to OutputSection.Shankar Easwaran2014-11-304-102/+95
| | | | | | No change in functionality. llvm-svn: 222972
* Rename R_AARCH64_TLSDESC_ADR_PAGE to R_AARCH64_TLSDESC_ADR_PAGE21Will Newton2014-11-261-1/+1
| | | | llvm-svn: 222823
* Fix comment in AArch64 ELF backendWill Newton2014-11-261-1/+1
| | | | llvm-svn: 222814
* [Mips] Use endian::read() for relocation addendum readingSimon Atanasyan2014-11-211-3/+5
| | | | llvm-svn: 222574
* [Mips] Simplify the code calculates HI16/LO16 relocationsSimon Atanasyan2014-11-201-15/+3
| | | | | | No functional changes. llvm-svn: 222470
* [Mips] Remove duplicated relocation calculation routinesSimon Atanasyan2014-11-201-20/+8
| | | | | | No functional changes. llvm-svn: 222469
* [Mips] Remove unused function argumentSimon Atanasyan2014-11-201-2/+2
| | | | | | No functional changes. llvm-svn: 222468
* [Mips] Use endian::read/write function to load/save MIPS32 instructionsSimon Atanasyan2014-11-201-39/+41
| | | | | | No functional changes. llvm-svn: 222467
* [Mips] Configure GOTPLT entries in the corresponding constructorSimon Atanasyan2014-11-201-6/+8
| | | | | | No functional changes. llvm-svn: 222415
* Revert "[ELF] Sectionkey should also contain path."Shankar Easwaran2014-11-191-18/+14
| | | | | | | | This reverts commit r222309. Reverting because of failures on darwin bot. llvm-svn: 222332
OpenPOWER on IntegriCloud