summaryrefslogtreecommitdiffstats
path: root/lld/ELF/LinkerScript.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Move the parser for the linker script to a separate file.Rui Ueyama2017-04-051-1155/+0
| | | | | | | | LinkerScript.cpp contains both the linker script processor and the linker script parser. I put both into a single file, but the file grown too large, so it's time to put them into two different files. llvm-svn: 299515
* Remove unused typedef.Rui Ueyama2017-04-051-2/+0
| | | | llvm-svn: 299514
* Do not use public inheritance where it is not needed.Rui Ueyama2017-04-051-1/+1
| | | | | | ScriptParser is not a ScriptLexer, so this should be a private inheritance. llvm-svn: 299513
* Simplify. NFC.Rui Ueyama2017-04-051-12/+6
| | | | llvm-svn: 299512
* Simplify. NFC.Rui Ueyama2017-04-051-4/+6
| | | | | | A for-loop is more boring than a find_if, but I think this is easier to read. llvm-svn: 299511
* Fix memory leak found by asan.Rui Ueyama2017-04-051-5/+5
| | | | llvm-svn: 299509
* Simplify and update comment.Rui Ueyama2017-04-051-20/+16
| | | | llvm-svn: 299508
* Simplify. NFC.Rui Ueyama2017-04-051-10/+7
| | | | llvm-svn: 299506
* Use make to create linker script command objects.Rui Ueyama2017-04-051-63/+59
| | | | | | It simplifies variable types. llvm-svn: 299505
* Remove default arguments because they don't improve readability.Rui Ueyama2017-04-051-3/+3
| | | | llvm-svn: 299504
* Add parentheses around `&`.Rui Ueyama2017-04-051-1/+1
| | | | llvm-svn: 299503
* Update comment.Rui Ueyama2017-04-051-4/+3
| | | | llvm-svn: 299502
* Use empty() instead of size().Rui Ueyama2017-04-051-1/+1
| | | | | | `!V.size()` where V is a vector is equivalent to `V.empty()`. llvm-svn: 299501
* Simplify. NFC.Rui Ueyama2017-04-051-8/+4
| | | | llvm-svn: 299500
* Make variable names consistent. NFC.Rui Ueyama2017-04-051-21/+22
| | | | llvm-svn: 299499
* Return a result from computeInputSections instead of mutating its argument.Rui Ueyama2017-04-051-18/+24
| | | | | | This should improve readability. llvm-svn: 299498
* Remove `=` from a lambda that doesn't capture any variable.Rui Ueyama2017-04-051-3/+4
| | | | llvm-svn: 299495
* Inline small functions that are used only once as lambdas.Rui Ueyama2017-04-051-18/+14
| | | | llvm-svn: 299494
* Add newlines.Rui Ueyama2017-04-051-0/+8
| | | | llvm-svn: 299493
* Make dummy variable's scope smaller.Rui Ueyama2017-04-051-3/+2
| | | | llvm-svn: 299492
* Update comments.Rui Ueyama2017-03-241-3/+3
| | | | llvm-svn: 298669
* [ELF] Allow references to reserved symbols in linker scriptsPetr Hosek2017-03-231-4/+7
| | | | | | | | | This requires collectign all symbols referenced in the linker script and adding them to symbol table as undefined symbol. Differential Revision: https://reviews.llvm.org/D31147 llvm-svn: 298577
* Make elf::ScriptConfig a LinkerScript class member variable.Rui Ueyama2017-03-211-14/+13
| | | | | | | | | | | | LinkerScript used to be a template class, so we couldn't instantiate that class in elf::link. We instantiated ScriptConfig class earlier instead so that the linker script parser can store configurations to the object. Now that LinkerScript is not a template, it doesn't make sense to separate ScriptConfig from LinkerScript. This patch merges them. llvm-svn: 298457
* Rename LinkerScriptBase -> LinkerScript.Rui Ueyama2017-03-211-38/+36
| | | | llvm-svn: 298456
* Sort. NFC.Rui Ueyama2017-03-211-25/+25
| | | | llvm-svn: 298447
* Define Config::Endianness.Rui Ueyama2017-03-211-5/+3
| | | | | | This is a shorthand for `Config->IsLE ? support::little : support::big`. llvm-svn: 298445
* Inline a few functions.Rafael Espindola2017-03-201-24/+6
| | | | | | | I don't foresee having to makes these functions any stricter or fancier, so it probably makes sense to inline them. llvm-svn: 298252
* Initialize dot.Rafael Espindola2017-03-201-0/+1
| | | | | | | This would fix an initialized error found by msan. The error is not showing after r298241, but it is not clear why. llvm-svn: 298251
* [ELF] - Reuse Config->IsLE. NFC.George Rimar2017-03-201-4/+1
| | | | llvm-svn: 298242
* [ELF] - Combine LinkerScriptBase and LinkerScript<ELFT>George Rimar2017-03-201-44/+61
| | | | | | | | | | | | Patch removes templated linkerscript class. Unfortunately that required 2 additional static methods findSymbol() and addRegularSymbol() because code depends on Symtab<ELFT>::X Differential revision: https://reviews.llvm.org/D30982 llvm-svn: 298241
* [ELF] - Apply clang-format. NFC.George Rimar2017-03-201-3/+3
| | | | llvm-svn: 298240
* Handle & and | of non abs values.Rafael Espindola2017-03-171-3/+19
| | | | | | | Handling & in particular is probably important because of its use in aligning addresses. llvm-svn: 298096
* Refuse to add two non absolute symbols.Rafael Espindola2017-03-171-0/+2
| | | | | | | Since there is no way to produce the correct answer at runtime, it is probably better to just err. llvm-svn: 298094
* Support non abs values in the rhs of +.Rafael Espindola2017-03-171-0/+2
| | | | llvm-svn: 298088
* Change our linker script expr representation.Rafael Espindola2017-03-171-82/+116
| | | | | | | | | | | | | | This fixes pr32031 by representing the expressions results as a SectionBase and offset. This allows us to use an input section directly instead of getting lost trying to compute an offset in an outputsection when not all the information is available yet. This also creates a struct to represent the *value* of and expression, allowing the expression itself to be a simple typedef. I think this is easier to read and will make it easier to extend the expression computation to handle more complicated cases. llvm-svn: 298079
* Remove unnecessary (). NFC.Rafael Espindola2017-03-171-2/+2
| | | | llvm-svn: 298076
* [ELF] - Detemplate SymbolBody::getVA and SymbolBody::getPltVA. NFC.George Rimar2017-03-171-1/+1
| | | | llvm-svn: 298071
* Revert r297850: [ELF] - Linkerscript: make Dot public and remove getDot(). NFC.Rui Ueyama2017-03-161-5/+5
| | | | | | | This reverts commit r297850 because this change was made based on a miscommunication. llvm-svn: 298001
* [ELF] - Detemplate SymbolBody::getOutputSection(). NFC.George Rimar2017-03-161-1/+1
| | | | llvm-svn: 297943
* [ELF] - Linkerscript: make Dot public and remove getDot(). NFC.George Rimar2017-03-151-5/+5
| | | | | | | Suggested by Rui Ueyama, also groups member variables in a single place, while I am here. llvm-svn: 297850
* [ELF] - Move LinkerScript::discard to LinkerScriptBase. NFC.George Rimar2017-03-151-3/+2
| | | | | | Became possible after r297844 llvm-svn: 297848
* Support ABSOLUTE on the right hand side in linker scriptsPetr Hosek2017-03-151-21/+15
| | | | | | | | | | | | This also requires postponing the assignment the assignment of symbols defined in input linker scripts since those can refer to output sections and in case we don't have a SECTIONS command, we need to wait until all output sections have been created and assigned addresses. Differential Revision: https://reviews.llvm.org/D30851 llvm-svn: 297802
* [ELF] - Move members of LinkerScript to LinkerScriptBase. NFC.George Rimar2017-03-141-35/+25
| | | | | | | | | | | | That moves all members that s possible to move for now (all which does not depend on ELFT templating). After that change LinkerScript contains only 8 methods in total, and I believe it is possible to move them all after tweaking other parts of linker. And we will be able to have single class for linkerscript at the end. llvm-svn: 297735
* [ELF] - Remove unnecessary template #6. NFC.George Rimar2017-03-141-4/+3
| | | | llvm-svn: 297734
* [ELF] - Remove unnecessary template #5. NFC.George Rimar2017-03-141-5/+4
| | | | llvm-svn: 297732
* [ELF] - Devirtualize LinkerScriptBase::getOutputSectionSize. NFC.George Rimar2017-03-141-14/+13
| | | | | | It does not use ELFT templates so can be non-virtual. llvm-svn: 297727
* [ELF] - Devirtualize LinkerScriptBase::getOutputSectionGeorge Rimar2017-03-141-13/+12
| | | | | | It does not use ELFT templates so can be non-virtual. llvm-svn: 297725
* [ELF] - Move ThreadBssOffset and Dot to LinkerScriptBase. NFC.George Rimar2017-03-141-5/+5
| | | | | | One more step to combine LinkerScript and LinkerScriptBase. llvm-svn: 297722
* [ELF] - Remove unnecessary template #4. NFC.George Rimar2017-03-141-2/+2
| | | | | | OutputSectionFactory has no ELFT templates anymore. llvm-svn: 297720
* [ELF] - Step to combine LinkerScript and LinkerScriptBaseGeorge Rimar2017-03-141-5/+1
| | | | | | | | | | | | | We can move all not templated functionality to LinkerScriptBase. Patch do that for hasPhdrsCommands() and shows how it helps to detemplate things in other places. Probably we should be able to merge these 2 classes into single one after such steps. Even if not, it still looks as reasonable cleanup for me. Differential revision: https://reviews.llvm.org/D30895 llvm-svn: 297714
OpenPOWER on IntegriCloud