| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
Patch adds support of <,>,!=,==,>=,<= operators.
Differential revision: http://reviews.llvm.org/D19419
llvm-svn: 267382
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 267219
|
|
|
|
| |
llvm-svn: 267218
|
|
|
|
|
|
| |
Now it is doable because LinkerScript is a template class.
llvm-svn: 267212
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 267134
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Patch implements ternary operator for linkerscript expressions.
Like:
SECTIONS {
. = 0x1 ? 0x2 : 0x3;
...
}
Differential revision: http://reviews.llvm.org/D19332
llvm-svn: 267132
|
|
|
|
|
|
| |
This short function was used only once and didn't provide much value.
llvm-svn: 267086
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
Also changed the function name and added comments.
llvm-svn: 267044
|
|
|
|
| |
llvm-svn: 266978
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 266914
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 266816
|
|
|
|
| |
llvm-svn: 266799
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch is based heavily on George Rimor's patch
http://reviews.llvm.org/D19221.
In the linker script, you can write expressions to compute addresses.
Currently we only support "+" operator. This adds a few more operators.
Since this patch adds * and /, we need to handle operator precedences
properly. I implemented that using the operator-precedence grammar.
Differential Revision: http://reviews.llvm.org/D19237
llvm-svn: 266798
|
|
|
|
|
|
|
|
| |
They are called sections-command in the doc, so it is nice to keep
it consistent with it.
https://sourceware.org/binutils/docs/ld/SECTIONS.html#SECTIONS
llvm-svn: 266668
|
|
|
|
| |
llvm-svn: 266667
|
|
|
|
| |
llvm-svn: 266666
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Do script driven layout only if SECTIONS section exist.
Initial commit message:
[ELF] - Implemented basic location counter support.
This patch implements location counter support.
It also separates assign addresses for sections to assignAddressesScript() if it scipt exists.
Main testcase is test/ELF/linkerscript-locationcounter.s, It contains some work with location counter. It is basic now.
Implemented location counter assignment and '+' operations.
Patch by myself with LOTS of comments and design suggestions from Rui Ueyama.
Differential revision: http://reviews.llvm.org/D18499
llvm-svn: 266526
|
|
|
|
|
|
|
| |
This reverts commit r266457 as it breaks "hello world" both on
Linux and FreeBSD.
llvm-svn: 266485
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch implements location counter support.
It also separates assign addresses for sections to assignAddressesScript() if it scipt exists.
Main testcase is test/ELF/linkerscript-locationcounter.s, It contains some work with location counter. It is basic now.
Implemented location counter assignment and '+' operations.
Patch by myself with LOTS of comments and design suggestions from Rui Ueyama.
Differential revision: http://reviews.llvm.org/D18499
llvm-svn: 266457
|
|
|
|
|
|
|
|
| |
This patch add a base script tokenizer class to decouple parsing from
linker script handling. The idea is to use this base class on dynamic
list parsing (--dynamic-list option). No functionality added.
llvm-svn: 265600
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
marker on error.
When error, this adds the text line of script to the output
and a marks exact incorrect token under it:
line 1: <error text here>
UNKNOWN_TAG {
^
Differential revision: http://reviews.llvm.org/D18699
llvm-svn: 265523
|
|
|
|
|
|
|
| |
This patch is based on http://reviews.llvm.org/D18545 written
by George Rimar.
llvm-svn: 264878
|
|
|
|
| |
llvm-svn: 263358
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
which was reverted because included
unrelative changes by mistake.
Original commit message:
[ELF] - Change all messages to lowercase to be consistent.
That is directly opposite to http://reviews.llvm.org/D18045,
which was reverted.
This patch changes all messages to start from lowercase letter if
they were not before.
That is done to be consistent with clang.
Differential revision: http://reviews.llvm.org/D18085
llvm-svn: 263337
|
|
|
|
|
|
| |
This reverts commit r263252 because the change contained unrelated changes.
llvm-svn: 263272
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
That is directly opposite to http://reviews.llvm.org/D18045,
which was reverted.
This patch changes all messages to start from lowercase letter if
they were not before.
That is done to be consistent with clang.
Differential revision: http://reviews.llvm.org/D18085
llvm-svn: 263252
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It was discussed to make all messages be
lowercase to be consistent with clang.
(also reverts the r263128 which fixed
build bot fail after r263125)
Original commit message:
[ELF] - Consistent spelling for error/warning messages
Previously error and warnings were not consistent in lld.
Some of them started from lowercase letter, others from
uppercase. Also there was one or two which had a dot at the end.
This patch changes all messages to start from uppercase letter if
they were not before.
Differential revision: http://reviews.llvm.org/D18045
llvm-svn: 263240
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously error and warnings were not consistent in lld.
Some of them started from lowercase letter, others from
uppercase. Also there was one or two which had a dot at the end.
This patch changes all messages to start from uppercase letter if
they were not before.
Differential revision: http://reviews.llvm.org/D18045
llvm-svn: 263125
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It was causing errors like
/lib/libc.so.6 is incompatible with elf_x86_64
when linking on Fedora.
Every system has different default paths. It seems better to just trust
the driver to pass the correct -L options.
This reverts commit 262910.
llvm-svn: 262941
|
|
|
|
|
|
|
| |
GNU ld and gold have these paths as default search paths.
If you don't want these directories, pass -nostdlib.
llvm-svn: 262910
|
|
|
|
|
|
|
| |
It is easier to handle section filler data separately rather than
merging with section names.
llvm-svn: 262175
|
|
|
|
| |
llvm-svn: 262174
|
|
|
|
| |
llvm-svn: 262159
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
BSD linker scripts contain special cases to add NOP
padding to code sections. Syntax is next:
.init:
{
KEEP (*(.init))
} =0x90909090
(0x90 is NOP)
This patch implements that functionality.
llvm-svn: 262020
|
|
|
|
|
|
|
| |
This class is used only in this translation unit, so no need
to instantiate them explicitly.
llvm-svn: 261951
|
|
|
|
|
|
|
|
| |
Change as was proposed by David Blaikie.
Differential revision: http://reviews.llvm.org/D17499
llvm-svn: 261729
|
|
|
|
|
|
|
|
|
|
|
| |
`?' - matches any single character
https://sourceware.org/binutils/docs/ld/Input-Section-Wildcards.html
This is used in linker scripts.
Differential revision: http://reviews.llvm.org/D17290
llvm-svn: 261726
|
|
|
|
|
|
|
|
|
|
|
| |
When link-time garbage collection is in use (-gc-sections), it is
often useful to mark sections that should not be eliminated.
This is accomplished by surrounding an input section's wildcard
entry with KEEP(). Patch implements that command.
Differential revision: http://reviews.llvm.org/D17242
llvm-svn: 261616
|
|
|
|
|
|
| |
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/17414
llvm-svn: 261322
|
|
|
|
|
|
|
|
|
| |
* Else-ifs in ScriptParser::run() replaced with std::function + map
* Reordered members of ScriptParser
Differential revision: http://reviews.llvm.org/D17256
llvm-svn: 261317
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Each rule in SECTIONS commands is something like ".foo *(.baz.*)",
which instructs the linker to collect all sections whose name matches
".baz.*" from all files and put them into .foo section.
Previously, we didn't recognize the wildcard character. This patch
adds that feature.
Performance impact is a bit concerning because a linker script can
contain hundreds of SECTIONS rules, and doing pattern matching against
each rule would be too expensive. We could merge all patterns into
single DFA so that it takes O(n) to the input size. However, it is
probably too much at this moment -- we don't know whether the
performance of pattern matching matters or not. So I chose to
implement the simplest algorithm in this patch. I hope this simple
pattern matcher is sufficient.
llvm-svn: 260745
|