summaryrefslogtreecommitdiffstats
path: root/lld/ELF/LinkerScript.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Instantiate Interp output section only when needed.Rui Ueyama2016-07-211-1/+1
| | | | | | | This change simplifies interaction between Writer and the linker script because we can make needsInterpSection() a file-scope function. llvm-svn: 276261
* [ELF] Support FLAGS attribute in program header definitionEugene Leviant2016-07-211-3/+9
| | | | llvm-svn: 276260
* [ELF] - Linkerscript: remove excessive ScriptConfiguration::Filler fieldGeorge Rimar2016-07-211-5/+6
| | | | | | | | | Previously OutputSectionCommand::Filler was introduced, but unused. Patch fixes that. Differential revision: https://reviews.llvm.org/D22615 llvm-svn: 276253
* [ELF] - Initial support of tree-style linker script implemented.George Rimar2016-07-211-28/+39
| | | | | | | | | | | Approach uses LLVM-style RTTI for representing the linker script commands in a form of tree for future simplification of parsing. Core idea and code sample belongs to Rui Ueyama. Differential revision: https://reviews.llvm.org/D22604 llvm-svn: 276243
* Function names should start with lowercase letters.Rui Ueyama2016-07-201-10/+10
| | | | llvm-svn: 276165
* Replace parallel arrays with a StringSwitch.Rui Ueyama2016-07-201-15/+18
| | | | llvm-svn: 276163
* Remove `else` after `break`.Rui Ueyama2016-07-201-2/+1
| | | | llvm-svn: 276162
* Simplify output section ownership.Rui Ueyama2016-07-201-3/+4
| | | | | | | | | This patch simplifies output section management by making Factory class have ownership of sections that creates. Differential Revision: https://reviews.llvm.org/D22575 llvm-svn: 276141
* [ELF] - Refactor of LinkerScript<ELFT>::getPhdrIndicesForSectionGeorge Rimar2016-07-201-11/+11
| | | | | | | | | Previously it was harder to read and also has a error: command kind was not checked. Differential revision: https://reviews.llvm.org/D22574 llvm-svn: 276137
* [ELF] Create output sections in LinkerScript classEugene Leviant2016-07-201-1/+41
| | | | llvm-svn: 276121
* Fix build with gcc 6.Rafael Espindola2016-07-191-1/+1
| | | | llvm-svn: 275972
* [ELF] Minimal PHDRS parser and section to segment assignment supportEugene Leviant2016-07-191-4/+182
| | | | llvm-svn: 275965
* Reformat comment from 3 to 2 lines. NFC.George Rimar2016-07-191-2/+1
| | | | llvm-svn: 275961
* Fixed comment. NFC.George Rimar2016-07-191-1/+1
| | | | llvm-svn: 275959
* [ELF] Overriding reserved symbols in linker scriptEugene Leviant2016-07-151-1/+1
| | | | llvm-svn: 275549
* Remove redundant `return`.Rui Ueyama2016-07-151-1/+0
| | | | llvm-svn: 275528
* Merge SymbolAssignmentKind and ExprKind.Rui Ueyama2016-07-151-15/+15
| | | | | | | | | In a linker script, `.` is a special symbol indicating a counter. Previously, we had two expression types, ExprKind and SymbolAssignmentKind for `.` and all the other symbol names, respectively. But we could merge them because the former is a special case of the latter. llvm-svn: 275527
* [ELF] r275383 reverted due to buildbot failureEugene Leviant2016-07-141-3/+3
| | | | llvm-svn: 275385
* [ELF] Allow overriding reserved symbols in linker scriptsEugene Leviant2016-07-141-3/+3
| | | | llvm-svn: 275383
* [ELF] Support for symbol assignment in linker scripts within SECTIONS {} blockEugene Leviant2016-07-121-17/+55
| | | | llvm-svn: 275158
* Fix formating. NFC.Rafael Espindola2016-07-071-1/+2
| | | | llvm-svn: 274757
* Remove trailing whitespaces.Rui Ueyama2016-07-011-3/+3
| | | | llvm-svn: 274343
* [ELF] Fix first PT_LOAD segment VA calculation, when linker script is usedEugene Leviant2016-07-011-1/+12
| | | | llvm-svn: 274342
* Create Strings.cpp and move string manipulation functions to that file.Rui Ueyama2016-06-291-24/+1
| | | | llvm-svn: 274109
* Rename matchStr -> globMatch.Rui Ueyama2016-06-291-4/+4
| | | | llvm-svn: 274103
* [ELF] Support for wildcard in version scripts.Davide Italiano2016-06-291-3/+1
| | | | | | | | | | | | | | | Example: VERSION_1.0 { global: foo*; local: *; } now correctly matches all the symbols which name starts with `foo`. Differential Revision: http://reviews.llvm.org/D21732 llvm-svn: 274091
* [LinkerScript] Spell 'character' correctly. NFC.Davide Italiano2016-06-261-1/+1
| | | | llvm-svn: 273817
* Rename Align -> Alignment.Rui Ueyama2016-06-171-2/+2
| | | | | | | | I think it is me who named these variables, but I always find that they are slightly confusing because align is a verb. Adding four letters is worth it. llvm-svn: 272984
* Fix the function to set the section VMA/LMA fields in case of usingDima Stepanov2016-05-191-25/+20
| | | | | | | | | | the linker script. The cycle in the ELF/LinkerScript.cpp:assignAddresses() routine will be used to go through all the sections and set all the addresses correctly. Add new test to check this case. llvm-svn: 270090
* Removed dead code. NFC.George Rimar2016-05-041-7/+0
| | | | llvm-svn: 268497
* [ELF] - Implemented comparsion operators for linkerscript.George Rimar2016-04-251-7/+25
| | | | | | | | Patch adds support of <,>,!=,==,>=,<= operators. Differential revision: http://reviews.llvm.org/D19419 llvm-svn: 267382
* Use ScriptParserBase features to parse linker script expressions.Rui Ueyama2016-04-231-71/+59
| | | | | | | | Previously, we have re-implemented utility functions such as `expect` or `next` in LinkerScript.cpp. This patch reuses the existing implementation that is in ScriptParser.cpp. llvm-svn: 267255
* Devirtualize ScriptParserBase. NFC.Rui Ueyama2016-04-221-1/+1
| | | | | | | | | | | ScriptParserBase class is a container of collection of various methods to parse linker script-ish text. It had a virtual method `run` to run the parser. But we don't have to enforce its descendents to implement that. It's up to them. This patch removes pure virtual function `run`. llvm-svn: 267246
* Inline getInteger as it's too short to be a function. NFC.Rui Ueyama2016-04-221-10/+4
| | | | llvm-svn: 267219
* Update a comment for r267145.Rui Ueyama2016-04-221-1/+2
| | | | llvm-svn: 267218
* Move uintX_t typedef to the class definition. NFC.Rui Ueyama2016-04-221-2/+0
| | | | | | Now it is doable because LinkerScript is a template class. llvm-svn: 267212
* [ELF] - Implemented linkerscript ALIGN commandGeorge Rimar2016-04-221-0/+8
| | | | | | | | | | | | ALIGN(exp) Return the location counter (.) aligned to the next exp boundary. (https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Using_ld_the_GNU_Linker/expressions.html) Patch implements this command. This fixes PR27406. Differential revision: http://reviews.llvm.org/D19364 llvm-svn: 267145
* Recommitted r267132 "[ELF] - implemented ternary operator for linkerscript ↵George Rimar2016-04-221-0/+14
| | | | | | | | | | | | | | | | | | | | | expressions" With fix: removed redundant Dot parameter. Original commit message: [ELF] - implemented ternary operator for linkerscript expressions Patch implements ternary operator for linkerscript expressions. Like: SECTIONS { . = 0x1 ? 0x2 : 0x3; ... } Differential revision: http://reviews.llvm.org/D19332 llvm-svn: 267140
* Revert r267132 as it broke buildbot.George Rimar2016-04-221-14/+0
| | | | llvm-svn: 267134
* [ELF] - implemented ternary operator for linkerscript expressionsGeorge Rimar2016-04-221-0/+14
| | | | | | | | | | | | | | Patch implements ternary operator for linkerscript expressions. Like: SECTIONS { . = 0x1 ? 0x2 : 0x3; ... } Differential revision: http://reviews.llvm.org/D19332 llvm-svn: 267132
* Inline SectionRule::match.Rui Ueyama2016-04-221-5/+1
| | | | | | This short function was used only once and didn't provide much value. llvm-svn: 267086
* ELF: Make the special variable "." as a LinkerScript class member.Rui Ueyama2016-04-221-21/+22
| | | | | | | | I will eventually make `evaluate` function a usual parse function rather than a function that works on a separate token list. This is the first step toward that. llvm-svn: 267083
* ELF: Change how to handle KEEP linker script command.Rui Ueyama2016-04-211-17/+24
| | | | | | | | | | | | | | | | | | You can instruct the linker to not discard sections even if they are unused and --gc-sections option is given. The linker script command for doing that is KEEP. The syntax is KEEP(foo) where foo is a section name. KEEP commands are written in SECTIONS command, so you can specify the order of sections *and* which sections will be kept. Each sub-command in SECTIONS command are translated into SectionRule object. Previously, each SectionRule has `Keep` bit. However, if you think about it, this hid information in too deep in elements of a list. Semantically, KEEP commands aren't really related to SECTIONS subcommands. We can keep the section list for KEEP in a separate list. This patch does that. llvm-svn: 267065
* ELF: Change the return type of getSectionOrder.Rui Ueyama2016-04-211-6/+10
| | | | | | Also changed the function name and added comments. llvm-svn: 267044
* [ELF] - Use ArrayRef instead of std::vector& for LinkerScript module. NFC.George Rimar2016-04-211-3/+3
| | | | llvm-svn: 266978
* [ELF] - Get rid of SectionOrder array.George Rimar2016-04-211-10/+16
| | | | | | | | | | | SectionOrder vector was a part of LinkerScript class. It can be removed because Commands vector contains the same information and SectiorOrder is just a subset. Differential revision: http://reviews.llvm.org/D19171 llvm-svn: 266974
* Define and use a utility function. NFC.Rui Ueyama2016-04-201-7/+16
| | | | llvm-svn: 266914
* ELF: Redefine parseExpr to parse an expression. NFC.Rui Ueyama2016-04-201-9/+12
| | | | | | | | | Previously the function reads an operator and the rest of the expressions. This patch makes it to actually parse an expression which starts with a primary pexression followed by other expressions concatenated with operators. llvm-svn: 266912
* ELF: Template LinkerScript class.Rui Ueyama2016-04-201-57/+41
| | | | | | | | | | | | | | | | | | | | | Originally, linker scripts were basically an alternative way to specify options to the command line options. But as we add more features to hanlde symbols and sections, many member functions needed to be templated. Now most the members are templated. It is probably time to template the entire class. Previously, LinkerScript is an executor of the linker script as well as a storage of linker script configurations. This is not suitable to template the class because when we are reading linker script files, we don't know the ELF type yet, so we can't instantiate ELF-templated classes. In this patch, I defined a new class, ScriptConfiguration, to store linker script configurations. ScriptParser writes parse results to it, and LinkerScript uses them. Differential Revision: http://reviews.llvm.org/D19302 llvm-svn: 266908
* Make a function file-scoped.Rui Ueyama2016-04-191-1/+1
| | | | llvm-svn: 266816
OpenPOWER on IntegriCloud