summaryrefslogtreecommitdiffstats
path: root/lld/lib/Core
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove dead code.Rui Ueyama2014-04-021-5/+0
| | | | llvm-svn: 205454
* s/llvm::dyn_cast/dyn_cast/Rui Ueyama2014-04-021-3/+3
| | | | 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
* 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
* 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
* Rename insertOneElementAt -> insertElementAt.Rui Ueyama2014-04-011-2/+2
| | | | | | | 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-011-53/+8
| | | | | | | | | | | | | | | | | | | | | 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
* [core] support .gnu.linkonce sectionsShankar Easwaran2014-04-012-6/+27
| | | | | | | | | | | | | | | | | | .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-312-24/+5
| | | | | | | | | 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-312-5/+24
| | | | | | | | | | | .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
* [ELF] Support --defsym option to define an absolute symbol.Rui Ueyama2014-03-281-2/+2
| | | | | | | | | | | | | | | | | 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-282-11/+15
| | | | | | | | | 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 typo.Rui Ueyama2014-03-281-1/+1
| | | | llvm-svn: 204984
* [core] add SectionGroup supportShankar Easwaran2014-03-263-16/+51
| | | | | | Review : http://llvm-reviews.chandlerc.com/D3182 llvm-svn: 204830
* [PECOFF] Support yet another new type of weak symbol.Rui Ueyama2014-03-181-14/+45
| | | | | | | | | | COMDAT_SELECT_LARGEST is a COMDAT type that make linker to choose the largest definition from among all of the definition of a symbol. If the size is the same, the choice is arbitrary. Differential Revision: http://llvm-reviews.chandlerc.com/D3011 llvm-svn: 204172
* Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-131-4/+4
| | | | | | | | This results in some simplifications to the code where an OwningPtr had to be used with the previous api and then ownership moved to a unique_ptr for the rest of lld. llvm-svn: 203809
* Fix a bug that mergeCases table does not match the merge constants.Rui Ueyama2014-03-081-0/+2
| | | | | | | | | | MergeCases table should not have an entry for MergeContents because atoms with MergeContents attribute should never have name. This issue was not caught by a test because getting a value of 6th element of an array of array actually gets the first element's value of the next array, and that happened to be a valid value. Added asserts to catch that error. llvm-svn: 203322
* [PECOFF] Support a new type of weak symbol.Rui Ueyama2014-03-071-20/+22
| | | | | | | | | | | | | | | Summary: COMDAT_SELECT_SAME_SIZE is a COMDAT type that I presume exist only in COFF. The semantics of the type is that linker should merge such COMDAT sections if their sizes are the same. Otherwise it's an error. Reviewers: Bigcheese, shankarke, kledzik CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2996 llvm-svn: 203308
* Add "override" and remove "virtual" where appropriate.Rui Ueyama2014-03-061-15/+15
| | | | | | | For the record, I used clang-modernize to add "override" and perl to remove "virtual". llvm-svn: 203164
* [C++11] Add #include's for OwningPtr.Ahmed Charles2014-03-031-0/+1
| | | | | | Allows removing #include's in LLVM while switching to std::unique_ptr. llvm-svn: 202679
* [CMake] Use target_link_libraries(INTERFACE|PRIVATE) on CMake-2.8.12 to ↵NAKAMURA Takumi2014-02-261-1/+1
| | | | | | | | | | | | | | | | | | increase opportunity for parallel build. target_link_libraries(INTERFACE) doesn't bring inter-target dependencies in add_library, although final targets have dependencies to whole dependent libraries. It makes most libraries can be built in parallel. target_link_libraries(PRIVATE) is used to shaared library. Each dependent library is linked to the target.so, and its user will not see its grandchildren. For example, - libclang.so has sufficient libclang*.a(s). - c-index-test requires just only libclang.so. FIXME: lld is tweaked minimally. Adding INTERFACE in each library would be better thing. llvm-svn: 202241
* Fix trailing whitespace.Shankar Easwaran2014-01-271-1/+1
| | | | llvm-svn: 200182
* Fix odd titlecasing and spacing in an error message.Rui Ueyama2014-01-181-2/+2
| | | | llvm-svn: 199530
* Use auto for readability. No functionality change.Rui Ueyama2014-01-181-9/+8
| | | | llvm-svn: 199527
* Using "final" as a variable name is a bit confusing in C++11, so rename it.Rui Ueyama2014-01-181-2/+2
| | | | llvm-svn: 199526
* Use getError instead of the error_code operator.Rafael Espindola2014-01-083-6/+7
| | | | llvm-svn: 198797
* TypoJoerg Sonnenberger2014-01-031-1/+1
| | | | llvm-svn: 198434
* The return value of createInternalFiles is unused, so remove it.Joey Gouly2013-12-311-2/+1
| | | | llvm-svn: 198266
* Fix a bug that undefined symbols are not reported if dead-stripping is enabled.Rui Ueyama2013-12-261-4/+0
| | | | | | | | There was a bug that the linker does not report an error if symbols specified by -u (or /include on Windows) are not resolved. This patch fixes it by adding such symbols to the dead strip root. llvm-svn: 198041
* Remove unnecessary call of DenseMap::clear.Rui Ueyama2013-12-261-3/+1
| | | | | | | It should be always true that _liveAtoms is empty, so we don't have to clear it. Add an assert() instead. llvm-svn: 198040
* Micro-optimize Resolver::markLive().Rui Ueyama2013-12-261-7/+5
| | | | | | This patch eliminates one std::set lookup per a function call. llvm-svn: 198037
* Simplify. No functionality change.Rui Ueyama2013-12-261-6/+3
| | | | llvm-svn: 198036
* Do not make an unnecessary copy of DenseMap.Rui Ueyama2013-12-261-1/+1
| | | | llvm-svn: 198035
* Remove duplicate methods.Rui Ueyama2013-12-261-4/+12
| | | | llvm-svn: 198034
* Make SimpleFileNode inherit from FileNode.Joey Gouly2013-12-191-2/+1
| | | | | | This removes a lot of duplicated code. llvm-svn: 197751
* [lld] Introduce registry and Reference kind tupleNick Kledzik2013-12-191-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main changes are in: include/lld/Core/Reference.h include/lld/ReaderWriter/Reader.h Everything else is details to support the main change. 1) Registration based Readers Previously, lld had a tangled interdependency with all the Readers. It would have been impossible to make a streamlined linker (say for a JIT) which just supported one file format and one architecture (no yaml, no archives, etc). The old model also required a LinkingContext to read an object file, which would have made .o inspection tools awkward. The new model is that there is a global Registry object. You programmatically register the Readers you want with the registry object. Whenever you need to read/parse a file, you ask the registry to do it, and the registry tries each registered reader. For ease of use with the existing lld code base, there is one Registry object inside the LinkingContext object. 2) Changing kind value to be a tuple Beside Readers, the registry also keeps track of the mapping for Reference Kind values to and from strings. Along with that, this patch also fixes an ambiguity with the previous Reference::Kind values. The problem was that we wanted to reuse existing relocation type values as Reference::Kind values. But then how can the YAML write know how to convert a value to a string? The fix is to change the 32-bit Reference::Kind into a tuple with an 8-bit namespace (e.g. ELF, COFFF, etc), an 8-bit architecture (e.g. x86_64, PowerPC, etc), and a 16-bit value. This tuple system allows conversion to and from strings with no ambiguities. llvm-svn: 197727
* [PECOFF] Refactor IdataPass.Rui Ueyama2013-12-111-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is to basically move the functionality to construct Data Directory from IdataPass to WriterPECOFF. Data Directory is a part of the PE/COFF header and contains the addresses of the import tables. We used to represent the link from Data Directory to the import tables as relocation references. The idea behind it is that, because relocation references are processed by the Writer, we wouldn't have to do anything special to fill the addresses of the import tables. I thought that the addresses would be set "automatically". But it turned out that that design made the pass and the writer rather complicated. In order to make relocation references between Data Directory to the import tables, these data structures needed to be represented as Atom. However, because Data Directory is not a section content but a part of the PE/COFF header, it did not fit well as an Atom. So we ended up having complicated code both in IdataPass and the writer. This patch simplifies it. One side effect of this patch is that we now have ".idata.a", ".idata.d" and "idata.t" sections for the import address table, the import directory table, and the import lookup table. The writer looks for the sections by name to find the start addresses of the sections. We probably should have a better way to find a specific atom from the core linking result, but currently using the section name seems to be the easiest way to do that. The Windows loader do not care about the import table's section layout. llvm-svn: 197016
* Style fixes. No functionality change.Rui Ueyama2013-12-101-10/+5
| | | | llvm-svn: 196883
* Make anonymous namespace as small as possible.Rui Ueyama2013-12-101-4/+2
| | | | | | Use of static is recommended by the style guide. llvm-svn: 196877
* Early return.Rui Ueyama2013-11-251-2/+4
| | | | llvm-svn: 195663
* Use range-based for loop.Rui Ueyama2013-11-251-3/+2
| | | | llvm-svn: 195662
* Indentation.Rui Ueyama2013-11-251-21/+21
| | | | llvm-svn: 195661
* [InputGraph][Gnu] Add LinkerScript support.Shankar Easwaran2013-11-242-2/+26
| | | | | | | | | | | | | | | | This adds LinkerScript support by creating a type Script which is of type FileNode in the InputGraph. Once the LinkerScript Parser converts the LinkerScript into a sequence of command, the commands are handled by the equivalent LinkerScript node for the current Flavor/Target. For ELF, a ELFGNULdScript gets created which converts the commands to ELF nodes and ELF control nodes(ELFGroup for handling Group nodes). Since the Inputfile type has to be determined in the Driver, the Driver needs to determine the complete path of the file that needs to be processed by the Linker. Due to this, few tests have been removed since the Driver uses paths that doesnot exist. llvm-svn: 195583
* [InputGraph] Add capability to process Hidden nodes.Shankar Easwaran2013-11-221-1/+5
| | | | | | | | | | Hidden nodes could be a result of expansion, where a flavor might decide to keep the node that we want to expand but discard it from being processed by the resolver. Verifies with unittests. llvm-svn: 195516
* [InputGraph] Expand InputGraph nodes.Shankar Easwaran2013-11-221-0/+32
| | | | | | | | | | | Flavors may like to expand InputGraph nodes, when a filenode after parsing results in more elements. One such example is while parsing GNU linker scripts. The linker scripts after parsing would result in a lot of filenodes and probably controlnodes too. Adds unittests to verify functionality. llvm-svn: 195515
* Fix indentation and whitespace.Rui Ueyama2013-11-211-57/+49
| | | | llvm-svn: 195389
* [LinkingContext] Limit shared library undefined atoms to be added.Shankar Easwaran2013-11-211-11/+16
| | | | | | | | | | | | This adds functionality to limit shared library undefined atoms to be added only once by the Resolver. Dynamic libraries may be processed more than once if they exist within a Group. Also adds a test to verify the change. llvm-svn: 195307
OpenPOWER on IntegriCloud