summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter
Commit message (Collapse)AuthorAgeFilesLines
...
* [LinkerScript] Implement linker script expression evaluationRafael Auler2015-03-091-2/+74
| | | | | | | | | | | 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
* [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-091-3/+3
| | | | | | | | | | | | | | | | 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
* 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-088-63/+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
* 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
* PECOFF: Optimize the writer using parallel_for.Rui Ueyama2015-03-061-8/+11
| | | | | | | | | Previously applying 1 million relocations took about 2 seconds on my Xeon 2.4GHz 8 core workstation. After this patch, it takes about 300 milliseconds. As a result, time to link chrome.dll becomes 23 seconds to 21 seconds. llvm-svn: 231454
* Remove else if a last block ends with return.Rui Ueyama2015-03-051-14/+10
| | | | llvm-svn: 231330
* Remove redundant virtual destructor.Rui Ueyama2015-03-051-3/+1
| | | | | | | DefinedAtom, which is the base class of ELFCommonAtom, has a virtual destructor, so this is redundant. llvm-svn: 231329
* PECOFF: Update comments on .drectve section encoding.Rui Ueyama2015-03-041-6/+4
| | | | llvm-svn: 231316
* PECOFF: Do not add layout-after edges.Rui Ueyama2015-03-042-19/+8
| | | | | | | | The last use of layout-after edge for PE/COFF was removed in r231290. Now layout-after edges do nothing. We can stop adding them to the graph. No functionality change intended. llvm-svn: 231301
* Define DefinedAtom::sectionSize.Rui Ueyama2015-03-046-24/+34
| | | | | | | | | | | | | | | | | | | | | | | | Merge::mergeByLargestSection is half-baked since it's defined in terms of section size, there's no way to get the section size of an atom. Currently we work around the issue by traversing the layout edges to both directions and calculate the sum of all atoms reachable. I wrote that code but I knew it's hacky. It's even not guaranteed to work. If you add layout edges before the core linking, it miscalculates a size. Also it's of course slow. It's basically a linked list traversal. In this patch I added DefinedAtom::sectionSize so that we can use that for mergeByLargestSection. I'm not very happy to add a new field to DefinedAtom base class, but I think it's legitimate since mergeByLargestSection is defined for section size, and the section size is currently just missing. http://reviews.llvm.org/D7966 llvm-svn: 231290
* Remove "inline" from inlined functions.Rui Ueyama2015-03-044-93/+66
| | | | llvm-svn: 231271
* Make File non-const in the resolver.Rui Ueyama2015-03-044-16/+16
| | | | | | | | | | | | | | | File objects are not really const in the resolver. We set ordinals to them and call beforeLink hooks. Also, File's member functions marked as const are not really const. ArchiveFile never returns the same member file twice, so it remembers files returned before. find() has side effects. In order to deal with the inconsistencies, we sprinkled const_casts and marked member varaibles as mutable. This patch removes const from there to reflect the reality. llvm-svn: 231212
* Revert "temporary"Rui Ueyama2015-03-041-22/+8
| | | | | | This reverts accidental commit r231205. llvm-svn: 231208
* Simplify FileArchive. NFC.Rui Ueyama2015-03-041-23/+15
| | | | | | | This patch moves local variable definitions so that their scope get narrower. Also uses range-based loop. Both are for readability. llvm-svn: 231206
* temporaryRui Ueyama2015-03-041-8/+22
| | | | llvm-svn: 231205
* Make a private function private.Rui Ueyama2015-03-041-21/+20
| | | | llvm-svn: 231196
* Implement our own future and use that for FileArchive::preload().Rui Ueyama2015-03-031-13/+9
| | | | | | | | | | | | | | std::promise and std::future in old version of libstdc++ are buggy. I think that's the reason why LLD tests were flaky on Ubuntu 13 buildbots until we disabled file preloading. In this patch, I implemented very simple future and used that in FileArchive. Compared to std::promise and std::future, it lacks many features, but should serve our purpose. http://reviews.llvm.org/D8025 llvm-svn: 231153
* Fix -Wcast-qual warning.Rui Ueyama2015-03-031-1/+1
| | | | llvm-svn: 231139
* [ELF] Implement R_X86_64_PC16 relocation.Davide Italiano2015-03-033-1/+11
| | | | | | | | | Yet another chapter in the story. We're getting there, finally. Note for the future: the tests for relocation have a lot of duplication and probably can be unified in a single file. Let's reevaluate this once the support will be complete (hopefully, soon). llvm-svn: 231057
* Make ArchiveLibraryFile::~ArchiveLibraryFile virtual.Rui Ueyama2015-03-021-2/+0
| | | | | | | | | "virtual" was present at a wrong place. FileArchive is a subclass of ArchiveLibraryFile, and a FileArchive can be deleted through a pointer of ArchiveLibraryFile. We want to make the destructor of the base class virtual. llvm-svn: 231033
* Remove include/lld/Core/Endian.h and use llvm/Support/Endian.h instead.Rui Ueyama2015-03-029-15/+23
| | | | llvm-svn: 231005
* Update the list of relocations that need to be implemented.Davide Italiano2015-03-021-2/+1
| | | | | | | While at it, point the correct document where the missing TLS relocation(s) are described. llvm-svn: 230937
* Add missing includes for make_unique, lld edition.Benjamin Kramer2015-03-0211-7/+13
| | | | llvm-svn: 230925
* Revert "PECOFF: Temporarily add a lock to un-break buildbot."Rui Ueyama2015-03-011-4/+0
| | | | | | | | | This reverts commit r230086. I added a lock to guard FileCOFF::doParse(), which killed parallel file parsing. Now the buildbots got back to green, I believe the threading issue was resolved, so it's time to remove the guard to see if it works with the buildbots. llvm-svn: 230886
* PECOFF: Move a call of WinLinkDriver::parse from FileCOFF::doParse to ↵Rui Ueyama2015-02-271-27/+26
| | | | | | | | | | | | | | | FileCOFF::beforeLink In doParse, we shouldn't do anything that has side effects. That function may be called speculatively and possibly in parallel. We called WinLinkDriver::parse from doParse to parse a command line in a .drectve section. The parse function updates a linking context object, so it has many side effects. It was not safe to call that function from doParse. beforeLink is a function for a File object to do something that has side effects. Moving a call of WinLinkDriver::parse to there. llvm-svn: 230791
* PECOFF: Use StringRef::find_first_of instead of a hand-written loop.Rui Ueyama2015-02-271-11/+3
| | | | llvm-svn: 230770
* [ELF] Set up initial live symbol(s) to avoid incorrect reclaim of atoms.Davide Italiano2015-02-271-0/+4
| | | | | | | | | | | | | If no initial live symbols are set up, and deadStrip() == true, the Resolver ends up reclaiming all the symbols that aren't absolute. This is wrong. This patch fixes the issue by setting entrySymbolName() as live, and this allows us to self-host lld when --gc-sections is enabled. There are still quite a few problems with --gc-sections (test failures), so the option can't be enabled by default. Differential Revision: D7926 Reviewed by: ruiu, shankarke llvm-svn: 230737
* Partially revert "PECOFF: Do not add layout-after edges."Rui Ueyama2015-02-272-7/+12
| | | | | | | | | This reverts commit r230732. sectionSize() in lib/Core/SymbolTable.cpp still depends on the layout- after edges, so we couldn't remove them yet. llvm-svn: 230734
* [ELF] Remove includes that are not usedShankar Easwaran2015-02-271-21/+0
| | | | | | This remove(s) include of the filename twice. llvm-svn: 230733
* PECOFF: Do not add layout-after edges.Rui Ueyama2015-02-272-18/+7
| | | | | | | | Previously we needed to create atoms as a doubly-linked link, but it's no longer needed. Also we don't use layout-after edges in PE/COFF. Creating such edges is just waste. llvm-svn: 230732
* Twine should be used within a statement.Rui Ueyama2015-02-271-3/+3
| | | | llvm-svn: 230730
* Update comments, fix typos.Rui Ueyama2015-02-272-4/+7
| | | | llvm-svn: 230729
* Use read{le,be}{16,32}. NFC.Rui Ueyama2015-02-271-24/+10
| | | | llvm-svn: 230728
OpenPOWER on IntegriCloud