summaryrefslogtreecommitdiffstats
path: root/lld/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove ordinals from Input Graph elements.Rui Ueyama2014-04-034-44/+7
| | | | | | | | | | | | | An ordinal is set to each child of Input Graph, but no one actually uses it. The only piece of code that gets ordinaly values is sortInputElements in InputGraph.cpp, but it does not actually do anything -- we assign ordinals in increasing order just before calling sort, so when sort is called it's already sorted. It's no-op. We can simply remove it. No functionality change. Differential Revision: http://llvm-reviews.chandlerc.com/D3270 llvm-svn: 205501
* Fix style.Rui Ueyama2014-04-031-5/+5
| | | | llvm-svn: 205490
* Minor style fix.Rui Ueyama2014-04-021-2/+1
| | | | llvm-svn: 205486
* Simplify communication between Resolver and Input Graph.Rui Ueyama2014-04-022-47/+22
| | | | | | | | | | | | | | | | | | | | | | | | Resolver is sending too much information to Input Graph than Input Graph actually needs. In order to collect the detailed information, which wouldn't be consumed by anyone, we have a good amount of code in Resolver, Input Graph and Input Elements. This patch is to simplify it. No functionality change. Specifically, this patch replaces ResolverState enum with a boolean value. The enum defines many bits to notify the progress about linking to Input Graph using bit masks, however, what Input Graph actually does is to compare a given value with 0. The details of the bit mask is simply being ignored, so the efforts to collect such data is wasted. This patch also changes the name of the notification interface from setResolverState to notifyProgress, to make it sounds more like message passing style. It's not a setter but something to notify of an update, so the new name should be more appropriate than before. Differential Revision: http://llvm-reviews.chandlerc.com/D3267 llvm-svn: 205463
* Remove dead code.Rui Ueyama2014-04-021-5/+0
| | | | llvm-svn: 205454
* s/llvm::dyn_cast/dyn_cast/Rui Ueyama2014-04-024-7/+4
| | | | llvm-svn: 205404
* Use cast<T> instead of dyn_cast<T>.Rui Ueyama2014-04-021-2/+2
| | | | llvm-svn: 205403
* Remove dead code.Rui Ueyama2014-04-021-6/+2
| | | | llvm-svn: 205401
* Remove dead code.Rui Ueyama2014-04-021-4/+0
| | | | llvm-svn: 205397
* [TODO] revisit features TODO in the driverShankar Easwaran2014-04-021-6/+2
| | | | llvm-svn: 205395
* Move nextFile() from LinkingContext to InputGraph.Rui Ueyama2014-04-023-36/+35
| | | | | | | | | | | | | | | | | LinkingContext and InputGraph are unnecessarily entangled. Most linker input file data, e.g. the vector containing input files, the next index of the input file, etc. are managed by InputGraph, but only the current input file is for no obvious reason managed by LinkingContext. This patch is to move code from LinkingContext to InputGraph to fix it. It's now clear who's reponsible for managing input file state, which is InputGraph, and LinkingContext is now free from that responsibility. It improves the readability as we now have fewer dependencies between classes. No functionality change. Differential Revision: http://llvm-reviews.chandlerc.com/D3259 llvm-svn: 205394
* [ELF] Create Attribute class associated with Input files.Shankar Easwaran2014-04-022-14/+14
| | | | | | | The attribute class holds positional attributes for Input files specified on the command line for the Gnu flavor. llvm-svn: 205392
* [ELF] Add -z muldefs option.Shankar Easwaran2014-04-021-0/+10
| | | | | | | | | This adds -z muldefs option which is widely used over --allow-multiple-definition. This option is supported by the GNU linker. llvm-svn: 205391
* Remove unused enum Position::ANY and third parameter of insertElementAt().Rui Ueyama2014-04-011-6/+7
| | | | | | | | | insertElementAt()'s third parameter is not only unused but also ignored if you pass Position::END. The actual meaning of the parameter was obscure. Differential Revision: http://llvm-reviews.chandlerc.com/D3256 llvm-svn: 205376
* Merge ELFGroup with Group.Rui Ueyama2014-04-012-3/+2
| | | | | | | | Group class is designed for GNU LD's --start-group and --end-group. There's no obvious need to have two classes for it -- one as an abstract base class and the other as a concrete class. llvm-svn: 205375
* Rename insertOneElementAt -> insertElementAt.Rui Ueyama2014-04-013-6/+5
| | | | | | | insertElementsAt() is removed, so "One" in insertOneElementAt() no longer make much sense. Rename it for brevity. llvm-svn: 205372
* Inline empty constructor.Rui Ueyama2014-04-011-5/+0
| | | | llvm-svn: 205366
* Greatly simplify InputGraph.Rui Ueyama2014-04-016-71/+21
| | | | | | | | | | | | | | | | | | | | | InputGraph has too many knobs and controls that are not being used. This patch is to remove dead code, unused features and a class. There are two things that worth noting, besides simple dead code removal: 1. ControlNode class is removed. We had it as the base class of Group class, but it provides no functionality particularly meaningful. We now have shallower class hierarchy that is easier to understand. 2. InputGraph provides a feature to replace a node with its internal data. It is being used to "expand" some type of node, such as a Linker Script node, with its actual files. We used to have two options when replacing it -- ExpandOnly or ExpandAndReplace. ExpandOnly was to expand it but not remove the node from the tree. There is no use of that option in the code, so it was a dead feature. Differential Revision: http://llvm-reviews.chandlerc.com/D3252 llvm-svn: 205363
* Remove dynamic casts.Rui Ueyama2014-04-011-6/+5
| | | | | | | | Asserting with cast<T> did not actually make much sense because there was no need to use dynamic casting in the first place. We could make the compiler to statically type check these objects. llvm-svn: 205350
* s/dyn_cast/cast/ where return value should never be null.Rui Ueyama2014-04-012-6/+7
| | | | | | | | cast<X> asserts the type is correct and does not return null on failure. So we should use cast<X> rather than dyn_cast<X> at such places where we don't expect type conversion could fail. llvm-svn: 205332
* [PECOFF] Make PECOFFFileNode::parse idempotent.Rui Ueyama2014-04-011-0/+3
| | | | | | | | PECOFFFileNode::parse can be called twice -- once by WinLink driver and once more by Driver. We want to make sure that the second call won't mess up the internal data. llvm-svn: 205284
* [PECOFF] Treat .imp as an import library file.Rui Ueyama2014-04-012-3/+7
| | | | | | | | | | | | Some Clang build uses .imp not .lib file extension for an import library file, so we need to treat such file as a library file. Ideally we should not rely on file extensions to detect file type. Instead we should use magic bytes at beginning of a file. The GNU-compatible driver actually does that but it made writing unit tests hard, so I chose an ad-hoc approach for now. llvm-svn: 205283
* [core] support .gnu.linkonce sectionsShankar Easwaran2014-04-014-9/+31
| | | | | | | | | | | | | | | | | | .gnu.linkonce sections are similar to section groups. They were supported before section groups existed and provided a way to resolve COMDAT sections using a different design. There are few implementations that use .gnu.linkonce sections to store simple floating point constants which doesnot require complex section group support but need a way to store only one copy of the floating point constant in a binary. .gnu.linkonce based symbol resolution achieves that. Review : http://llvm-reviews.chandlerc.com/D3242 llvm-svn: 205280
* Revert "[core] support .gnu.linkonce sections"Shankar Easwaran2014-03-314-33/+9
| | | | | | | | | This reverts commit 5d5ca72a7876c3dd3dd1db83dc6a0d74be9e2cd1. Discuss on a better design to raise error when there is a similar group with Gnu linkonce sections and COMDAT sections. llvm-svn: 205224
* [core] support .gnu.linkonce sectionsShankar Easwaran2014-03-314-9/+33
| | | | | | | | | | | .gnu.linkonce sections are similar to section groups. They were supported before section groups existed and provided a way to resolve COMDAT sections using a different design. There are few implementations that use .gnu.linkonce sections to store simple floating point constants which doesnot require complex section group support but need a way to store only one copy of the floating point constant. .gnu.linkonce based symbol resolution achieves that. llvm-svn: 205163
* [MachO] Remove "virtual" and add "override".Rui Ueyama2014-03-288-85/+81
| | | | llvm-svn: 205057
* [ELF] Add "override" and remove "virtual".Rui Ueyama2014-03-2818-281/+224
| | | | llvm-svn: 205056
* [ELF] Terminate argv with nullptr.Rui Ueyama2014-03-281-7/+2
| | | | | | Also remove unused vector. llvm-svn: 205052
* [ELF] Support response file.Rui Ueyama2014-03-281-1/+48
| | | | | | | | | Response file is a command line argument in the form of @file. The GNU- compatible driver expands the file contents, replacing @file argument. Differential Revision: http://llvm-reviews.chandlerc.com/D3210 llvm-svn: 205038
* Attempt to unbreak buildbots.Rui Ueyama2014-03-281-1/+1
| | | | llvm-svn: 205034
* [ELF] Support --defsym option to define an absolute symbol.Rui Ueyama2014-03-285-6/+62
| | | | | | | | | | | | | | | | | This patch is to support --defsym option for ELF file format/GNU-compatible driver. Currently it takes a symbol name followed by '=' and a number. If such option is given, the driver sets up an absolute symbol with the specified address. You can specify multiple --defsym options to define multiple symbols. GNU LD's --defsym provides many more features. For example, it allows users to specify another symbol name instead of a number to define a symbol alias, or it even allows a symbol plus an offset (e.g. --defsym=foo+3) to define symbol- relative alias. This patch does not support that, but will be supported in subsequent patches. Differential Revision: http://llvm-reviews.chandlerc.com/D3208 llvm-svn: 205029
* [ELF] Add --allow-multiple-definition option.Rui Ueyama2014-03-284-11/+22
| | | | | | | | | If --allow-multiple-definition option is given, LLD does not treat duplicate symbol error as a fatal error. GNU LD supports this option. Differential Revision: http://llvm-reviews.chandlerc.com/D3211 llvm-svn: 205015
* Fix format.Rui Ueyama2014-03-281-1/+1
| | | | llvm-svn: 204989
* [ELF] Remove class declarations that do nothing.Rui Ueyama2014-03-281-76/+0
| | | | | | | These classes are declared in a .cpp file but not used in the same compliation unit. They seems to have been copy-and-pasted from ELFReader.h. llvm-svn: 204988
* Replace nested switches with if.Rui Ueyama2014-03-281-15/+5
| | | | llvm-svn: 204987
* Remove extraneous parentheses.Rui Ueyama2014-03-281-2/+2
| | | | llvm-svn: 204986
* Fix typo.Rui Ueyama2014-03-281-1/+1
| | | | llvm-svn: 204984
* Make anonymous namespace as small as possible.Rui Ueyama2014-03-274-45/+42
| | | | llvm-svn: 204982
* Do not use layout-before to layout atoms.Rui Ueyama2014-03-271-74/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we use both layout-after and layout-before edges to specify atom orders in the resulting executable. We have a complex piece of code in LayoutPass.cpp to deal with both types of layout specifiers. (In the following description, I denote "Atom A having a layout-after edge to B" as "A -> B", and A's layout-before to B as "A => B".) However, that complexity is not really needed for this reason: If there are atoms such that A => B, B -> A is always satisifed, so using only layout- after relationships will yield the same result as the current code. Actually we have a piece of complex code that verifies that, for each A -> B, B => [ X => Y => ... => Z => ] A is satsified, where X, Y, ... Z are all zero-size atoms. We can get rid of the code from our codebase because layout- before is basically redundant. I think we can simplify the code for layout-after even more than this, but I want to just remove this pass for now for simplicity. Layout-before edges are still there for dead-stripping, so this change won't break it. We will remove layout-before in a followup patch once we fix the dead-stripping pass. Differential Revision: http://llvm-reviews.chandlerc.com/D3164 llvm-svn: 204966
* [PECOFF] Avoid C-style cast.Rui Ueyama2014-03-261-1/+1
| | | | llvm-svn: 204855
* [PECOFF] Use RAII object for mutex.Rui Ueyama2014-03-261-15/+8
| | | | llvm-svn: 204853
* [core] add SectionGroup supportShankar Easwaran2014-03-266-26/+170
| | | | | | Review : http://llvm-reviews.chandlerc.com/D3182 llvm-svn: 204830
* Remove safeguard from RoundTripYAML pass.Rui Ueyama2014-03-261-14/+6
| | | | | | | | | | | | RoundTripYAML pass is removed from the regular execution pass in r204296, so the safeguard to protect it from OOM error is no longer needed, because we are sure that the pass is only used for tests, and test files are all small. We also want to see RoundTripYAML pass to fail in tests if it fails, rather than silently skipping failing tests. llvm-svn: 204772
* [PECOFF] Print out command line if we have expanded response files.Rui Ueyama2014-03-251-3/+15
| | | | | | | | | | | If a response file is given via command line, the final command line arguments will not appear in the log because the actual arguments are in the given file. This patch is to show the final command line if /verbose is specified to help users. llvm-svn: 204754
* [Mips] Fix formatting.Simon Atanasyan2014-03-241-1/+1
| | | | llvm-svn: 204607
* [Mips] Sort R_MIPS_LO16 / R_MIPS_HI16 / R_MIPS_GOT16 before findingSimon Atanasyan2014-03-241-9/+29
| | | | | | pairs and calculate AHL addend. llvm-svn: 204606
* Use early continues to reduce nesting.Rui Ueyama2014-03-211-117/+120
| | | | llvm-svn: 204523
* [PECOFF] Rename link.exe -> lld-link.exe.Rui Ueyama2014-03-211-0/+1
| | | | | | | Creating the file "link.exe" made some confusion, so it's better to name it lld-link.exe, as we did for CL (clang-cl.exe). llvm-svn: 204509
* [Mips] Emit LA25 MIPS stubs to call pic code from non-pic routines.Simon Atanasyan2014-03-212-22/+137
| | | | llvm-svn: 204503
* [Mips] Fix source code formatting. No functional changes.Simon Atanasyan2014-03-211-11/+11
| | | | llvm-svn: 204472
OpenPOWER on IntegriCloud