summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/PECOFF
Commit message (Collapse)AuthorAgeFilesLines
* COFF: Remove the old COFF linker and make link an alias to link2.Rui Ueyama2015-08-0621-5470/+0
| | | | | | It's time to remove old COFF linker because the new one is now complete. llvm-svn: 244226
* Fix -Wextra-semi.Rui Ueyama2015-07-232-4/+4
| | | | | | Patch from Eugene.Zelenko! llvm-svn: 243060
* Fix undefined behaviour exposed by the new -Wshift-negative-value warning.Davide Italiano2015-07-071-1/+1
| | | | llvm-svn: 241530
* Simplify Pass::perform to take a SimpleFile& instead of unique_ptr<SimpleFile>&David Blaikie2015-06-199-29/+29
| | | | | | | | None of the implementations replace the SimpleFile with some other file, they just modify the SimpleFile in-place, so a direct reference to the file is sufficient. llvm-svn: 240167
* [lld] Allow LLD passes to return error codes.Lang Hames2015-06-199-18/+28
| | | | llvm-svn: 240147
* Update for llvm api change.Rafael Espindola2015-06-131-6/+5
| | | | llvm-svn: 239671
* Use MemoryBufferRef instead of MemoryBuffer&. NFC.Rafael Espindola2015-04-242-2/+2
| | | | | | This just reduces the noise from another patch. llvm-svn: 235776
* Return an ErrorOr<std::unique_ptr<File>>. NFC.Rafael Espindola2015-04-242-10/+11
| | | | llvm-svn: 235741
* Delete unnecessary generality in loadFile.Rafael Espindola2015-04-242-10/+8
| | | | | | | | | | | | | loadFile could load mulitple files just because yaml has a feature for putting multiple documents in one file. Designing a linker around what yaml can do seems like a bad idea to me. This patch changes it to read a single file. There are further improvements to be done to the api and they will follow shortly. llvm-svn: 235724
* Define make_dynamic_error_code(const char *).Rui Ueyama2015-04-141-1/+1
| | | | | | | | | | | | The function took either StringRef or Twine. Since string literals are ambiguous when resolving the overloading, many code calls used this function with explicit type conversion. That led awkward code like make_dynamic_error_code(Twine("Error occurred")). This patch adds a function definition for string literals, so that you can directly call the function with literals. llvm-svn: 234841
* Revert r234649 "PECOFF: Use C++11 braced init list to make Version objects."Nico Weber2015-04-111-6/+8
| | | | | | | | | | | | | | This doesn't compile with MSVC 2013: include\lld/ReaderWriter/PECOFFLinkingContext.h(356) : error C2797: 'lld::PECOFFLinkingContext::_imageVersion': list initialization inside member initializer list or non-static data member initializer is not implemented include\lld/ReaderWriter/PECOFFLinkingContext.h(357) : error C2797: 'lld::PECOFFLinkingContext::_imageVersion': list initialization inside member initializer list or non-static data member initializer is not implemented llvm-svn: 234676
* PECOFF: Use C++11 braced init list to make Version objects.Rui Ueyama2015-04-101-8/+6
| | | | llvm-svn: 234649
* Do s/_context/_ctx/g globally.Rui Ueyama2015-04-101-4/+4
| | | | | | | | I believe this patch eliminates all remaining uses of _context or _linkingContext variable names. Consistent naming improves readability. llvm-svn: 234645
* Remove the Native file format.Rui Ueyama2015-04-102-6/+5
| | | | | | | | | | | | | The Native file format was designed to be the fastest on-memory or on-disk file format for object files. The problem is that no one is working on that. No LLVM tools can produce object files in the Native, thus the feature of supporting the format is useless in the linker. This patch removes the Native file support. We can add it back if we really want it in future. llvm-svn: 234641
* Rename atom_collection -> AtomVector.Rui Ueyama2015-04-083-17/+17
| | | | | | Type names should start with an uppercase letter in the LLVM coding style. llvm-svn: 234452
* Separate atom_collection type into two different types. NFC.Rui Ueyama2015-04-083-9/+9
| | | | | | | | | | | | | | | | | | | | atom_collection is basically a wrapper for std::vector. The class provides begin and end member functions, so that it "hides" the other member functions provided by std::vector. However, you can still directly access _atoms member since the member is not protected. We cannot simply make the member private because we need that member when we are constructing atom vectors. This patch splits atom_collection into two types: std::vector<Atom *> and AtomRange. When we are constructing atom vectors, we use the former class. We return instances of the latter class from File objects so that callers cannot add or remove atoms from the lists. std::vector<Atom *> is automatically converted to AtomRange. llvm-svn: 234450
* Merge atom_collection_vector with atom_collection.Rui Ueyama2015-04-083-7/+7
| | | | | | | atom_collection_vector is the only derived class of atom_collection. This patch merges the two. llvm-svn: 234443
* Merge MutableFile with SimpleFile.Rui Ueyama2015-04-079-22/+22
| | | | | | | | SimpleFile is the only derived class of MutableFile. This patch reduces the height of class hierarchy by removing MutableFile class. llvm-svn: 234354
* Replace the `createImplicitFiles` method return type with `void`Simon Atanasyan2015-04-061-3/+1
| | | | | | | All instances of the `createImplicitFiles` always return `true` and this return value is used nowhere. llvm-svn: 234205
* Remove a parameter for file extension from canParse.Rui Ueyama2015-04-042-5/+3
| | | | | | | | canParse took three parameters -- file magic, filename extension and memory buffer. All but YAMLReader ignored the second parameter. This patch removes the parameter. llvm-svn: 234080
* Remove Makefiles.Rui Ueyama2015-03-261-14/+0
| | | | | | | | Most developers prefer to not have them, and we agreed to remove them from LLD. http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-March/083368.html llvm-svn: 233313
* Use alignment values everywhere instead of log2.Rui Ueyama2015-03-266-15/+13
| | | | | | | | This patch defines implicit conversion between integers and PowerOf2 instances, so uses of the classes is now implicit and look like regular integers. Now we are ready to remove the scaffolding. llvm-svn: 233245
* Remove implicit constructor and operator int from PowerOf2.Rui Ueyama2015-03-261-3/+3
| | | | | | | | | | This patch is to make instantiation and conversion to an integer explicit, so that we can mechanically replace all occurrences of the class with integer in the next step. Now get() returns an alignment value rather than its log2 value. llvm-svn: 233242
* PECOFF: Reduce import table size.Rui Ueyama2015-03-241-6/+19
| | | | | | | | | | | | | Import Lookup Table in Import Directory Table has the same contents as Hint/Name Table. Symbol names imported from DLLs are pointed by both Import Directory Table and Hint/Name Table. We had duplicate strings there. This patch eliminates that duplication to make the table smaller. This should reduce binary size by the sum of lengths of imported symbols. llvm-svn: 233128
* PECOFF: Do not copy all undefined symbols to a set. NFC.Rui Ueyama2015-03-181-12/+8
| | | | llvm-svn: 232646
* Remove unused parameter.Rui Ueyama2015-03-181-7/+3
| | | | llvm-svn: 232639
* PECOFF: Make FileCOFF:findAtomAt from O(n) to O(1).Rui Ueyama2015-03-161-19/+18
| | | | | | | | I knew I cut corners when I wrote this. Turned out that it is actually slow when a file being read has many symbols. This patch is to stop doing linear search and instead do map lookup. llvm-svn: 232436
* [ELF] Ability to resolve undefined symbols lazilyDenis Protivensky2015-03-141-42/+8
| | | | | | | | | 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
* 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
* Add SimpleAbsoluteAtom which is analogous to other Simple* atoms.Rui Ueyama2015-03-093-21/+3
| | | | 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
* 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-081-3/+0
| | | | | | | | 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
* 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
* 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-042-20/+24
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Make File non-const in the resolver.Rui Ueyama2015-03-041-2/+2
| | | | | | | | | | | | | | | 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
* Fix -Wcast-qual warning.Rui Ueyama2015-03-031-1/+1
| | | | llvm-svn: 231139
* Remove include/lld/Core/Endian.h and use llvm/Support/Endian.h instead.Rui Ueyama2015-03-023-3/+6
| | | | llvm-svn: 231005
* Add missing includes for make_unique, lld edition.Benjamin Kramer2015-03-023-0/+3
| | | | llvm-svn: 230925
OpenPOWER on IntegriCloud