Rui Ueyama
f62d260744
Simplify. NFC.
...
llvm-svn: 299512
2017-04-05 05:06:37 +00:00
Rui Ueyama
e31d98869d
Simplify. NFC.
...
A for-loop is more boring than a find_if, but I think this is easier to read.
llvm-svn: 299511
2017-04-05 05:06:17 +00:00
Rui Ueyama
01aacc94b9
Fix memory leak found by asan.
...
llvm-svn: 299509
2017-04-05 03:52:47 +00:00
Rui Ueyama
4e1e88e300
Simplify and update comment.
...
llvm-svn: 299508
2017-04-05 03:52:28 +00:00
Rui Ueyama
c8124ee9a3
Simplify. NFC.
...
llvm-svn: 299506
2017-04-05 03:21:01 +00:00
Rui Ueyama
8f99f73c8f
Use make to create linker script command objects.
...
It simplifies variable types.
llvm-svn: 299505
2017-04-05 03:20:42 +00:00
Rui Ueyama
d379f7357d
Remove default arguments because they don't improve readability.
...
llvm-svn: 299504
2017-04-05 03:20:22 +00:00
Rui Ueyama
cba41013ef
Add parentheses around &.
...
llvm-svn: 299503
2017-04-05 03:20:03 +00:00
Rui Ueyama
d7c5400f9e
Update comment.
...
llvm-svn: 299502
2017-04-05 03:19:43 +00:00
Rui Ueyama
cc400cc8ac
Use empty() instead of size().
...
`!V.size()` where V is a vector is equivalent to `V.empty()`.
llvm-svn: 299501
2017-04-05 03:19:24 +00:00
Rui Ueyama
0b2381e71f
Simplify. NFC.
...
llvm-svn: 299500
2017-04-05 03:19:06 +00:00
Rui Ueyama
2e081a4ff0
Make variable names consistent. NFC.
...
llvm-svn: 299499
2017-04-05 03:18:46 +00:00
Rui Ueyama
72e107f302
Return a result from computeInputSections instead of mutating its argument.
...
This should improve readability.
llvm-svn: 299498
2017-04-05 02:05:48 +00:00
Rui Ueyama
2c7171bf3c
Remove = from a lambda that doesn't capture any variable.
...
llvm-svn: 299495
2017-04-05 00:43:45 +00:00
Rui Ueyama
ea93fe00b9
Inline small functions that are used only once as lambdas.
...
llvm-svn: 299494
2017-04-05 00:43:25 +00:00
Rui Ueyama
5f20b6304b
Add newlines.
...
llvm-svn: 299493
2017-04-05 00:43:05 +00:00
Rui Ueyama
a08fa2eca3
Make dummy variable's scope smaller.
...
llvm-svn: 299492
2017-04-05 00:42:45 +00:00
Rui Ueyama
81cb710784
Update comments.
...
llvm-svn: 298669
2017-03-24 00:15:57 +00:00
Petr Hosek
30f16b2339
[ELF] Allow references to reserved symbols in linker scripts
...
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
2017-03-23 03:52:34 +00:00
Rui Ueyama
a34da93847
Make elf::ScriptConfig a LinkerScript class member variable.
...
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
2017-03-21 23:03:09 +00:00
Rui Ueyama
b8dd23f56e
Rename LinkerScriptBase -> LinkerScript.
...
llvm-svn: 298456
2017-03-21 23:02:51 +00:00
Rui Ueyama
fc16173ceb
Sort. NFC.
...
llvm-svn: 298447
2017-03-21 21:49:16 +00:00
Rui Ueyama
f93ed4de2e
Define Config::Endianness.
...
This is a shorthand for `Config->IsLE ? support::little : support::big`.
llvm-svn: 298445
2017-03-21 21:40:08 +00:00
Rafael Espindola
195f23c53b
Inline a few functions.
...
I don't foresee having to makes these functions any stricter or
fancier, so it probably makes sense to inline them.
llvm-svn: 298252
2017-03-20 14:35:41 +00:00
Rafael Espindola
49592cf679
Initialize dot.
...
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
2017-03-20 14:33:33 +00:00
George Rimar
b17d16a2a1
[ELF] - Reuse Config->IsLE. NFC.
...
llvm-svn: 298242
2017-03-20 10:16:57 +00:00
George Rimar
a8dba48762
[ELF] - Combine LinkerScriptBase and LinkerScript<ELFT>
...
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
2017-03-20 10:09:58 +00:00
George Rimar
009833d377
[ELF] - Apply clang-format. NFC.
...
llvm-svn: 298240
2017-03-20 09:51:18 +00:00
Rafael Espindola
7ba5f47eb8
Handle & and | of non abs values.
...
Handling & in particular is probably important because of its use in
aligning addresses.
llvm-svn: 298096
2017-03-17 14:55:36 +00:00
Rafael Espindola
5f08a1dca8
Refuse to add two non absolute symbols.
...
Since there is no way to produce the correct answer at runtime, it is
probably better to just err.
llvm-svn: 298094
2017-03-17 14:51:07 +00:00
Rafael Espindola
f2115f04c8
Support non abs values in the rhs of +.
...
llvm-svn: 298088
2017-03-17 13:45:36 +00:00
Rafael Espindola
72dc195d78
Change our linker script expr representation.
...
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
2017-03-17 13:05:04 +00:00
Rafael Espindola
490fccb170
Remove unnecessary (). NFC.
...
llvm-svn: 298076
2017-03-17 13:00:45 +00:00
George Rimar
f64618a621
[ELF] - Detemplate SymbolBody::getVA and SymbolBody::getPltVA. NFC.
...
llvm-svn: 298071
2017-03-17 11:56:54 +00:00
Rui Ueyama
98e55de699
Revert r297850: [ELF] - Linkerscript: make Dot public and remove getDot(). NFC.
...
This reverts commit r297850 because this change was made
based on a miscommunication.
llvm-svn: 298001
2017-03-16 21:50:30 +00:00
George Rimar
69268a8ab3
[ELF] - Detemplate SymbolBody::getOutputSection(). NFC.
...
llvm-svn: 297943
2017-03-16 11:06:13 +00:00
George Rimar
20055d4cd2
[ELF] - Linkerscript: make Dot public and remove getDot(). NFC.
...
Suggested by Rui Ueyama,
also groups member variables in a single place, while I am here.
llvm-svn: 297850
2017-03-15 16:07:02 +00:00
George Rimar
503206c567
[ELF] - Move LinkerScript::discard to LinkerScriptBase. NFC.
...
Became possible after r297844
llvm-svn: 297848
2017-03-15 15:42:44 +00:00
Petr Hosek
02ad516b2e
Support ABSOLUTE on the right hand side in linker scripts
...
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
2017-03-15 03:33:23 +00:00
George Rimar
a2a1ef1abc
[ELF] - Move members of LinkerScript to LinkerScriptBase. NFC.
...
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
2017-03-14 12:03:34 +00:00
George Rimar
23e6a02450
[ELF] - Remove unnecessary template #6 . NFC.
...
llvm-svn: 297734
2017-03-14 11:31:28 +00:00
George Rimar
f7f0d08827
[ELF] - Remove unnecessary template #5 . NFC.
...
llvm-svn: 297732
2017-03-14 11:23:33 +00:00
George Rimar
d83ce1b49d
[ELF] - Devirtualize LinkerScriptBase::getOutputSectionSize. NFC.
...
It does not use ELFT templates so can be non-virtual.
llvm-svn: 297727
2017-03-14 10:24:47 +00:00
George Rimar
851dc1e84d
[ELF] - Devirtualize LinkerScriptBase::getOutputSection
...
It does not use ELFT templates so can be non-virtual.
llvm-svn: 297725
2017-03-14 10:15:53 +00:00
George Rimar
0c1c8085bc
[ELF] - Move ThreadBssOffset and Dot to LinkerScriptBase. NFC.
...
One more step to combine LinkerScript and LinkerScriptBase.
llvm-svn: 297722
2017-03-14 10:00:19 +00:00
George Rimar
e21c3af7e9
[ELF] - Remove unnecessary template #4 . NFC.
...
OutputSectionFactory has no ELFT templates anymore.
llvm-svn: 297720
2017-03-14 09:30:25 +00:00
George Rimar
2d2621090d
[ELF] - Step to combine LinkerScript and LinkerScriptBase
...
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
2017-03-14 09:03:53 +00:00
Eugene Leviant
5784e96f5c
[ELF] Fix LMA offset calculation
...
Differential revision: https://reviews.llvm.org/D30832
llvm-svn: 297713
2017-03-14 08:57:09 +00:00
George Rimar
78aa270041
[ELF] - Remove unnecessary template. NFC.
...
llvm-svn: 297622
2017-03-13 14:40:58 +00:00
Rafael Espindola
4595df94bb
Don't pass Dot to every callback.
...
It is available from ScriptBase.
llvm-svn: 297472
2017-03-10 16:04:26 +00:00