| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
| |
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
|
|
|
|
|
|
| |
We don't have to use a MapVector here. Instead, just std::vector suffices.
llvm-svn: 260724
|
|
|
|
| |
llvm-svn: 260598
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, we had code for linker scripts in Writer. This patch
separates that as LinkerScript class. The class provides a few
functions to query linker scripts and is also a container of some
linker-script-specific information.
Hopefully, Writer will only implement the default behavior and let
the new class handle gotchas regarding linker scripts.
llvm-svn: 260591
|
|
|
|
|
|
| |
This reverts r259395 which reverted r259143.
llvm-svn: 259572
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds "Error" field to LinkerScript class. That field
is false by default, and set to true if there is a syntax error
in an input file. The linker script parser is a recursive-descedent
parser. Each function returns if Error is true -- so that
eventually the whole parser returns to a caller.
http://reviews.llvm.org/D16667
llvm-svn: 259557
|
|
|
|
| |
llvm-svn: 259395
|
|
|
|
|
|
|
|
|
| |
This patch let the driver keep going until it parses all
command line options.
http://reviews.llvm.org/D16645
llvm-svn: 259143
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In many situations, we don't want to exit at the first error even in the
process model. For example, it is better to report all undefined symbols
rather than reporting the first one that the linker picked up randomly.
In order to handle such errors, we don't need to wrap everything with
ErrorOr (thanks for David Blaikie for pointing this out!) Instead, we
can set a flag to record the fact that we found an error and keep it
going until it reaches a reasonable checkpoint.
This idea should be applicable to other places. For example, we can
ignore broken relocations and check for errors after visiting all relocs.
In this patch, I rename error to fatal, and introduce another version of
error which doesn't call exit. That function instead sets HasError to true.
Once HasError becomes true, it stays true, so that we know that there
was an error if it is true.
I think introducing a non-noreturn error reporting function is by itself
a good idea, and it looks to me that this also provides a gradual path
towards lld-as-a-library (or at least embed-lld-to-your-program) without
sacrificing code readability with lots of ErrorOr's.
http://reviews.llvm.org/D16641
llvm-svn: 259069
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There was an off by one error because the StringRef.substr functions
second argument is a length, not the end index.
Also updated a few ELF files which failed when run on Jenkins with paths
including the @ character. This is often used in Jenkins for shared
workspace plugin.
Reviewed by Rui Ueyama
llvm-svn: 258583
|
|
|
|
| |
llvm-svn: 256970
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If an argument of the INPUT directive is a regular path, linker should
lookup it in the current folder first.
The fix does not contain any test cases because I think it is not a good
idea to pollute a current folder (which in general might be arbitrary)
by test files.
Differential Revision: http://reviews.llvm.org/D15027
llvm-svn: 254178
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In case a sysroot prefix is configured, and the filename starts with
the '/' character, and the script being processed was located inside
the sysroot prefix, the file's name will be looked for in the sysroot
prefix. Otherwise, the linker falls to the common lookup scheme.
It is slightly modified version of the commit r254031. The problem of
the initial commit was in the `is_absolute` call. On Windows 'C:\' is
absolute path but we do not need to find it under sysroot. In this patch
linker looks up a path under sysroot only if the paths starts with '/'
character.
llvm-svn: 254135
|
|
|
|
| |
llvm-svn: 254052
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The test fails on Windows:
Command 34: "ld.lld" "-o" "D:\src\llvm\build.release\tools\lld\test\ELF\Output\l
inkerscript.s.tmp2" "D:\src\llvm\build.release\tools\lld\test\ELF\Output\linkers
cript.s.tmp.dir/xyz.script" "--sysroot=D:\src\llvm\build.release\tools\lld\test\
ELF\Output\linkerscript.s.tmp.dir"
Command 34 Result: 1
Command 34 Output:
Command 34 Stderr:
Unable to find /libxyz.a
llvm-svn: 254049
|
|
|
|
| |
llvm-svn: 254032
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In case a sysroot prefix is configured, and the filename starts with the
'/' character, and the script being processed was located inside the
sysroot prefix, the file's name will be looked for in the sysroot
prefix. Otherwise, the linker falls to the common lookup scheme.
https://www.sourceware.org/binutils/docs-2.24/ld/File-Commands.html
Differential Revision: http://reviews.llvm.org/D14916
llvm-svn: 254031
|
|
|
|
|
|
|
|
|
|
| |
* determine output section by input section name
* discard input sections
* order output sections accordingly
Differential Revision: http://reviews.llvm.org/D14140
llvm-svn: 252868
|
|
|
|
|
|
|
|
| |
The reason of collecting all undefines in vector is that during reading files we already need to have Symtab created. Or like was done in that patch - to put undefines from scripts somewhere to delay Symtab.addUndefinedOpt() call.
Differential Revision: http://reviews.llvm.org/D13870
llvm-svn: 250711
|
|
|
|
|
|
|
|
|
| |
The documentation says: "You may separate commands using semicolons",
so they seem to be optional.
Differential Revision: http://reviews.llvm.org/D13703
llvm-svn: 250223
|
|
|
|
| |
llvm-svn: 250215
|