summaryrefslogtreecommitdiffstats
path: root/lld/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "[ELF] Change few static functions."Shankar Easwaran2015-03-142-3/+3
| | | | | | | | This reverts commit r232253. Fix comments from dblaikie. Since these functions dont access member state, its ok to be static. llvm-svn: 232271
* [ELF] Ability to resolve undefined symbols lazilyDenis Protivensky2015-03-146-49/+128
| | | | | | | | | Handle resolution of symbols coming from linked object files lazily. Add implementation of handling _GLOBAL_OFFSET_TABLE_ and __exidx_start/_end symbols for ARM platform. Differential Revision: http://reviews.llvm.org/D8159 llvm-svn: 232261
* [ELF] Change few static functions.Shankar Easwaran2015-03-142-3/+3
| | | | | | Functions hasOutputSegment/maybeGetSOName doesnot need not be static. llvm-svn: 232253
* [ELF] Rename .got.dyn to .gotShankar Easwaran2015-03-142-2/+2
| | | | | | Gnu doesnot creates only a .got section. llvm-svn: 232252
* [ELF] Fix DenseMapInfo for StringRefShankar Easwaran2015-03-141-1/+1
| | | | llvm-svn: 232251
* [ELF] Remove ambiguityShankar Easwaran2015-03-142-2/+2
| | | | | | Fix ambiguous finalize function. llvm-svn: 232250
* [ELF] Simplify appending chunks to segments.Shankar Easwaran2015-03-141-17/+10
| | | | | | | | The Segment Chunk had two functions one to append a section and one to append a chunk. A section is a subclass of a chunk and clearly this can be merged into one single function. llvm-svn: 232249
* LinkerScript: Add -T <scriptfile> optionMeador Inge2015-03-134-5/+15
| | | | | | | | | | | GNU LD has an option named -T/--script which allows a user to specify a linker script to be used [1]. LLD already accepts linker scripts without this option, but the option is widely used. Therefore it is best to support it in LLD as well. [1] https://sourceware.org/binutils/docs/ld/Options.html#Options llvm-svn: 232183
* LinkerScript: Add evaluation of the EXTERN commandMeador Inge2015-03-121-0/+5
| | | | | | This patch implements evaluation of the GNU ld EXTERN command. llvm-svn: 232111
* LinkerScript: Add parsing of the EXTERN commandMeador Inge2015-03-121-0/+46
| | | | | | | | | This patch implements parsing of the GNU ld EXTERN command [1]. Evaluation will be added at a later point in time. [1] https://sourceware.org/binutils/docs/ld/Miscellaneous-Commands.html#Miscellaneous-Commands llvm-svn: 232110
* Rephrase find loop to use std::find_ifDavid Blaikie2015-03-121-11/+7
| | | | | | Avoids the need for an assert-only variable, among other benefits. llvm-svn: 232088
* [Mips] Make `readAddend` a virtual member function to escape explicitSimon Atanasyan2015-03-123-28/+27
| | | | | | | | template class instantiation No functional changes. llvm-svn: 232081
* Fix configure & make build by adding support for the ExampleSubTarget.Iain Sandoe2015-03-122-0/+17
| | | | llvm-svn: 232030
* Avoid an unused variable warning when assertions are offJustin Bogner2015-03-121-0/+1
| | | | | | Patch by Mike Edwards. Thanks! llvm-svn: 232015
* Fix a comparison function to actually be a SWO so that it conforms toChandler Carruth2015-03-111-15/+18
| | | | | | | | | | | | | | | | | | | | | | | | the spec required by std::sort and friends. Ordering things this way also dramatically simplifies the code as short-circuit ensures we can skip all of the negative tests. I've left one FIXME where we're establishing a fairly arbitrary ordering. Previously, the function compared all types as equal except for the ones it explicitly handled, but it didn't delegate correctly to the atomflags when doing so, and so it would fail to be a SWO. The two possible fixes are to stop comparing the atom flags entirely, or to establish some arbitrary ordering of the types. Since it was pure luck which ordering of unequal types we ended up with previously (the caller was std::sort, not std::stable_sort) I chose to make the ordering explicit and guaranteed. This seems like the best conservative approach as I suspect we would want to switch to stable_sort otherwise in order to have deterministic output. Differential Revision: http://reviews.llvm.org/D8266 llvm-svn: 231968
* LinkerScript: Add parsing of the MEMORY commandMeador Inge2015-03-111-0/+120
| | | | | | | | | | | This patch implements parsing of the GNU ld MEMORY command [1]. The command and the memory block definitions are parsed as specified (including the slightly strange "o" and "l" keywords). Evaluation will be added at a later point in time. [1] https://sourceware.org/binutils/docs-2.25/ld/MEMORY.html llvm-svn: 231928
* Garbage collect an unused class in Atoms.hDavide Italiano2015-03-111-30/+0
| | | | | | | | | | This will be replaced by a more generic class to handle all the default symbols in an executable, e.g. __init_array. Differential Revision: http://reviews.llvm.org/D8234 Reviewed by: shankare llvm-svn: 231906
* Fix the local variable naming I used in r231765 to follow the LLD codingChandler Carruth2015-03-101-4/+4
| | | | | | conventions. Sorry for missing this before I committed the patch! llvm-svn: 231766
* Fix a bug where the code would use subscript a std::vector with the sizeChandler Carruth2015-03-101-6/+7
| | | | | | | | | | | | | | | | | | of the vector. For a vector 'v', '&v[v.size()]' isn't a valid way to compute a pointer one-past-the-end of the vector. Instead, write the loop in terms of iterators and save the beginning iterator. Once we have that we can compute the beginning pointer from the beginning iterator, and compute the distance which we should increment the beginning pointer by subtracting the iterators. What might be simpler would be to convert the function accepting a raw pointer for begin and end to accept iterators or a range or some other construct, but I wanted to keep this to a minimal bug-fix change. This fixes a crash on any debug STL implementation which checks for indexing out of bounds. llvm-svn: 231765
* Use template aliases.Rui Ueyama2015-03-106-50/+50
| | | | | | We dropped Visual Studio 2012 support, so we can use template aliases. llvm-svn: 231756
* Add SimpleAbsoluteAtom which is analogous to other Simple* atoms.Rui Ueyama2015-03-094-38/+5
| | | | llvm-svn: 231718
* Remove COFFReference and use SimpleReference instead.Rui Ueyama2015-03-095-62/+47
| | | | | | | SimpleReference, which is defined in Core, provides the same functionality as COFFReference does, so we don't need a custom class. llvm-svn: 231715
* [LinkerScript] Implement linker script expression evaluationRafael Auler2015-03-092-2/+79
| | | | | | | | | | | The expression evaluation is needed when interpreting linker scripts, in order to calculate the value for new symbols or to determine a new position to load sections in memory. This commit extends Expression nodes from the linker script AST with evaluation functions, and also contains a unit test. http://reviews.llvm.org/D8156 llvm-svn: 231707
* Remove dead code.Rui Ueyama2015-03-091-1/+0
| | | | llvm-svn: 231688
* [Mips] Remove unused includeSimon Atanasyan2015-03-091-1/+0
| | | | | | No functional changes. llvm-svn: 231646
* [Mips] Remove redundant namespace qualifiersSimon Atanasyan2015-03-092-41/+41
| | | | | | No functional changes. llvm-svn: 231645
* [Mips] Rename local variablesSimon Atanasyan2015-03-091-6/+5
| | | | | | No functional changes. llvm-svn: 231644
* [Mips] Implement R_MIPS_SUB relocation handlingSimon Atanasyan2015-03-091-0/+7
| | | | llvm-svn: 231643
* [Mips] Implement R_MIPS_64 relocation handlingSimon Atanasyan2015-03-092-32/+68
| | | | llvm-svn: 231642
* [Mips] Refactoring of relocation handling functionsSimon Atanasyan2015-03-094-239/+232
| | | | | | | | | | | 1. Move relocation addendum reading code to the MipsRelocationHandler class to reduce code duplication. 2. Factor out the relocations calculation code into the separate function to be ready to handle MIPS N64 ABI relocation chains. No functional changes. llvm-svn: 231641
* [Mips] Show error message and stop linking in case of cross mode jump errorsSimon Atanasyan2015-03-091-12/+16
| | | | llvm-svn: 231640
* [Mips] Fix incorrect handling of cross mode jumpsSimon Atanasyan2015-03-091-24/+38
| | | | | | | | We should not take in account a type of "source" symbol. Cross mode jump adjustment is requred when target symbol and relocation belong to different (regular/microMIPS) instruction sets. llvm-svn: 231639
* [MachO] Use setter for globalsAreDeadStripRoots. NFC intended.Davide Italiano2015-03-091-2/+2
| | | | llvm-svn: 231629
* PECOFF: Create layout-afters instead of layout-befores.Rui Ueyama2015-03-092-4/+4
| | | | | | | | | | | | | | | | All readers except PE/COFF reader create layout-after edges to preserve the original symbol order. PE/COFF uses layout-before edges as primary edges for no reason. This patch makes PE/COFF reader to create layout-after edges. Resolver is updated to recognize reverse edges of layout-after edges in the garbage collection pass. Now we can retire layout-before edges. I don't do that in this patch because if I do, I would have updated many tests to replace all occurrrences of "layout-before" with "layout-after". So that's a TODO. llvm-svn: 231615
* PECOFF: Define and use BaseReloc type instead of std::pair.Rui Ueyama2015-03-081-33/+29
| | | | | | | "first" and "second" are not easy to memorize. Define a type to use meaningful names. llvm-svn: 231614
* Revert r231552: Resolver: optimize fallback atoms.Rui Ueyama2015-03-081-4/+5
| | | | | | This patch broke a buildbot. llvm-svn: 231611
* Re-commit r231545: PECOFF: Do not add extraneous symbols to the dead strip rootRui Ueyama2015-03-081-5/+3
| | | | | | | That commit was reverted in r231582 as it was a culprit for buildbot breakage. Turned out it's not. llvm-svn: 231610
* PECOFF: Fix off-by-one error.Rui Ueyama2015-03-081-1/+1
| | | | | | We accidentally skipped the last base relocation entry for each block. llvm-svn: 231586
* PECOFF: Parallelize base relocation creation.Rui Ueyama2015-03-081-29/+31
| | | | | | | | | | | | | | | | | If an output is large, its base relocation section can be also large. For example, chrome.dll is almost 300 MB, and it has about 9 million base relocations. Creating the section took 1.5 seconds on my machine. This patch changes the way to create the section so that we can use parallel_sort to group base relocations by high bits. This change makes the linker almost 4% faster for the above test case on my machine. If I replace parallel_sort with std::sort, performance remains the same, so single thread performance should remain the same. This has no functionality change. The output should be identical as before. llvm-svn: 231585
* Remove sectionPosition attribute.Rui Ueyama2015-03-089-68/+9
| | | | | | | | This code is simply dead. No one is using it. http://reviews.llvm.org/D8125 llvm-svn: 231583
* Revert r231545 to unbreak buildbot.Rui Ueyama2015-03-081-3/+5
| | | | | | | | | This patch reverts r231545 "PECOFF: Do not add extraneous symbols to the dead strip root." CrWinClangLLD buildbot is currently broken. Since I can't reproduce the issue locally, I'm reverting the most relevant change. llvm-svn: 231582
* Remove duplicate code. NFC.Rui Ueyama2015-03-074-16/+3
| | | | llvm-svn: 231570
* Update makefile to reflect that the Passes directory is gone here.Chandler Carruth2015-03-071-1/+1
| | | | llvm-svn: 231557
* Resolver: optimize fallback atoms.Rui Ueyama2015-03-071-5/+4
| | | | | | | | | | | Atoms with fallback atoms are never be added to the symbol table. However, we added such atoms to _undefines array. We had to call isCoalescedAway to identify and skip them. We should just stop adding them in the first place. This seems to make the linker ~1% faster in my test case. llvm-svn: 231552
* Resolver: Reduce number of SymbolTable::isDefined function calls.Rui Ueyama2015-03-071-1/+1
| | | | | | | | If an undefined symbol is added to the symbol table by the previous call of SymbolTable::add, SymbolTable::isDefined will always return false for the same symbol. llvm-svn: 231551
* Resolver: Reduce number of hash function call.Rui Ueyama2015-03-071-2/+2
| | | | | | | | | | | | | | | | | This is yet another optimization patch. Previously we called SymbolTable::isDefined() and SymbolTable::findByName() from a very frequently executed function. Because isDefined calls findByName, findByName is called twice on each iteration. findByName is not a cheap function. It computes a hash value for a given symbol name. When linking C++ programs, it can be expensive because of C++ mangled long symbols. This patch reduces the number of call from 2 to 1. Performance improvements by this patch was larger than I expected. Linking time of chrome.dll gets almost 5% shorter. llvm-svn: 231549
* PECOFF: Do not add extraneous symbols to the dead strip root.Rui Ueyama2015-03-071-5/+3
| | | | | | | | | | Previously we added all undefined symbols found in object files to the dead strip root. This patch makes the linker to stop doing that. Undefined symbols would be resolved anyway, so this patch doesn't change the linker behavior. It should slightly improve performance but it's really marginal. This is a cleanup. llvm-svn: 231545
* Remove unused typedefs.Rui Ueyama2015-03-071-5/+0
| | | | llvm-svn: 231543
* Use multimap<T, U> instead of map<T, set<U>>. NFC.Rui Ueyama2015-03-071-11/+6
| | | | llvm-svn: 231542
* Resolver: move code inside an assert.Rui Ueyama2015-03-061-4/+3
| | | | llvm-svn: 231518
OpenPOWER on IntegriCloud