| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This implements INSERT AFTER in a following way:
During reading scripts it collects all insert statements.
After we done and read all files it inserts statements into script commands list.
With that:
* Rest of code does know nothing about INSERT.
* Approach is straightforward and have no visible limitations.
* It is also easy to support INSERT BEFORE (was seen in clang code once).
* Should work for PR35877 and similar cases.
Cons:
* It assumes we have "main" scripts that describes sections.
Differential revision: https://reviews.llvm.org/D43468
llvm-svn: 327003
|
|
|
|
| |
llvm-svn: 326753
|
|
|
|
|
|
|
|
|
|
|
| |
"division by zero" or "modulo by zero" are not
very informative errors and even probably confusing
as does not let to know that error is coming from linker script.
Patch adds location reporting.
Differential revision: https://reviews.llvm.org/D43934
llvm-svn: 326686
|
|
|
|
|
|
|
|
|
|
|
| |
LLD crashes with broken scripts shown in testcase,
because fails to read memory regon name and accesses
MemoryRegions's element which is nullptr.
Patch fixes it.
Differential revision: https://reviews.llvm.org/D43866
llvm-svn: 326431
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is PR36515.
Currenly if we have a script like .debug_info 0 : { *(.debug_info) },
we would not remove this section and keep it in the output.
That does not work, because it is common case for
debug sections to have a zero address expression.
Patch changes behavior so that we remove only sections
that do not use symbols in its expressions.
Differential revision: https://reviews.llvm.org/D43863
llvm-svn: 326430
|
|
|
|
|
|
|
|
| |
This patch improves compatibility with GNU linkers.
Differential Revision: https://reviews.llvm.org/D43883
llvm-svn: 326348
|
|
|
|
| |
llvm-svn: 326347
|
|
|
|
|
|
| |
Addresses forgotten comment for D43071.
llvm-svn: 325332
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is PR36298.
(COPY), (INFO), (OVERLAY) all have the same effect:
section should be marked as non-allocatable.
(https://www.eecs.umich.edu/courses/eecs373/readings/Linker.pdf,
3.6.8.1 Output Section Type)
Differential revision: https://reviews.llvm.org/D43071
llvm-svn: 325331
|
|
|
|
|
|
|
|
|
| |
In GNU linkers, the last semicolon is optional. We can't link libstdc++
with lld because of that difference.
Differential Revision: https://reviews.llvm.org/D42820
llvm-svn: 324036
|
|
|
|
|
|
| |
We can just use a member variable in MemoryRegion.
llvm-svn: 323399
|
|
|
|
|
|
|
|
| |
The problem we had with it is that anything inside an AT is an
expression, so we failed to parse the section name because of the - in
it.
llvm-svn: 322801
|
|
|
|
|
|
|
|
|
| |
parseInt assumed that it could take a negative number literal (e.g.
"-123"). However, such number is in reality already handled as a
unary operator '-' followed by a number literal, so the number
literal is always non-negative. Thus, this code is dead.
llvm-svn: 322453
|
|
|
|
|
|
|
|
|
|
|
| |
AT> lma_region expression allows to specify the memory region
for section load address.
Should fix PR35684.
Differential revision: https://reviews.llvm.org/D41397
llvm-svn: 322359
|
|
|
|
| |
llvm-svn: 321458
|
|
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D41577
llvm-svn: 321453
|
|
|
|
|
|
|
|
|
|
| |
When two linker script symbols are subtracted, the result should be absolute.
This is the behavior of binutils' ld.
Patch by Erick Reyes!
llvm-svn: 321390
|
|
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D40571
llvm-svn: 319221
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This matches the behaviour of ld.bfd:
https://sourceware.org/binutils/docs/ld/Options.html#Options
If scriptfile does not exist in the current directory, ld looks for it in
the directories specified by any preceding '-L' options. Multiple '-T'
options accumulate.
Reviewers: ruiu, grimar
Reviewed By: ruiu, grimar
Subscribers: emaste, llvm-commits
Differential Revision: https://reviews.llvm.org/D40129
llvm-svn: 318655
|
|
|
|
|
|
|
|
| |
Fixes PR34948.
Differential Revision: https://reviews.llvm.org/D39511
llvm-svn: 317396
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When findMemoryRegion do search to find a region for output section it
iterates over MemoryRegions which is DenseMap and so does not
guarantee iteration in insertion order. As a result selected region depends
on its name and not on its definition position
Testcase shows the issue, patch fixes it. Behavior after applying the patch
seems consistent with bfd.
Differential revision: https://reviews.llvm.org/D39544
llvm-svn: 317307
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
The COFF linker and the ELF linker have long had similar but separate
Error.h and Error.cpp files to implement error handling. This change
introduces new error handling code in Common/ErrorHandler.h, changes the
COFF and ELF linkers to use it, and removes the old, separate
implementations.
Reviewers: ruiu
Reviewed By: ruiu
Subscribers: smeenai, jyknight, emaste, sdardis, nemanjai, nhaehnle, mgorny, javed.absar, kbarton, fedor.sergeev, llvm-commits
Differential Revision: https://reviews.llvm.org/D39259
llvm-svn: 316624
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is PR34886.
SUBALIGN command currently triggers failture if result expression
is zero. Patch fixes the issue, treating zero as 1, what is consistent with
other places and ELF spec it seems.
Patch also adds "is power of 2" check for this and other expressions
returning alignment.
Differential revision: https://reviews.llvm.org/D38846
llvm-svn: 316580
|
|
|
|
|
|
|
|
| |
This patch doesn't change the behavior of the program because it
would eventually return None at end of the function. But it is
better to return None early if we know it will eventually happen.
llvm-svn: 315495
|
|
|
|
|
|
|
|
|
| |
Usually, a function that does symbol lookup takes symbol name as
its first argument. Also, if a function takes a source location hint,
it is usually the last parameter. So the previous parameter order
was counter-intuitive.
llvm-svn: 315433
|
|
|
|
| |
llvm-svn: 315431
|
|
|
|
|
|
|
|
|
|
| |
"Commands" was ambiguous because in the linker script, everything is
a command. We used to handle only SECTIONS commands, and at the time,
it might make sense to call them the commands, but it is no longer
the case. We handle not only SECTIONS but also MEMORY, PHDRS, VERSION,
etc., and they are all commands.
llvm-svn: 315409
|
|
|
|
|
|
|
|
| |
HasSections is true if there is at least one SECTIONS linker
script command, and it is not directly related to whether we have
section objects or not. So I think the new name is better.
llvm-svn: 315405
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ScriptConfiguration was a class to contain parsed results of
linker scripts. LinkerScript is a class to interpret it.
That ditinction was needed because we haven't instantiated
LinkerScript early (because, IIRC, LinkerScript class was a
ELFT template function). So, when we parse linker scripts,
we couldn't directly store the result to a LinkerScript instance.
Now, that limitation is gone. We instantiate LinkerScript
at the very beginning of our main function. We can directly
store parse results to a LinkerScript instance.
llvm-svn: 315403
|
|
|
|
|
|
| |
I think three ctors are too many for this simple class.
llvm-svn: 315394
|
|
|
|
| |
llvm-svn: 315168
|
|
|
|
|
|
|
| |
This patch also make its return type to `void` because
it always returns a given value as-is.
llvm-svn: 315165
|
|
|
|
| |
llvm-svn: 315164
|
|
|
|
|
|
|
|
|
| |
This patch goes back to considering ForceAbsolute in moveAbsRight, but
only if the second argument is not already absolute.
With this we can handle "foo + ABSOLUTE(foo)" and "ABSOLUTE(foo) + foo".
llvm-svn: 313800
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The idea of this function is to simplify the implementation of binary
operators like add.
A value might be absolute because of an ABSOLUTE expression, but it
still depends on the value of a section and we might not be able to
evaluate it early. We should keep such values on the LHS, so that we
can delay the evaluation.
We can now handle both "1 + ABSOLUTE(foo)" and "ABSOLUTE(foo) + 1".
llvm-svn: 313794
|
|
|
|
|
|
|
| |
This fixes two more cases where we were aligning the offset in a
section, instead of the final address.
llvm-svn: 312983
|
|
|
|
| |
llvm-svn: 312820
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This allows combining --dynamic-list and version scripts too. The
version script controls which symbols are visible, and
--dynamic-list controls which of those are preemptible.
Unlike previous versions, undefined symbols are still considered
preemptible, which was the issue breaking the cfi tests.
This fixes pr34053.
llvm-svn: 312806
|
|
|
|
|
|
|
|
|
|
|
|
| |
REGION_ALIAS(alias, region)
Alias names can be added to existing memory regions created with
the MEMORY command. Each name corresponds to at most one
memory region.
Differential revision: https://reviews.llvm.org/D37477
llvm-svn: 312777
|
|
|
|
|
|
|
|
|
|
| |
symbols are preemptible""
This reverts commit r312757.
Evgenii Stepanov reports that it broke some tests.
llvm-svn: 312771
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
preemptible"
If --dynamic-list is given, only those symbols are preemptible.
This allows combining --dynamic-list and version scripts too. The
version script controls which symbols are visible, and --dynamic-list
controls which of those are preemptible.
This fixes pr34053.
llvm-svn: 312757
|
|
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D37524
llvm-svn: 312656
|
|
|
|
| |
llvm-svn: 312655
|
|
|
|
|
|
| |
This reverts commit r311468 because it broke some CFI bots.
llvm-svn: 311497
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Patch by Rafael Espíndola.
This is PR34053.
The implementation is a bit of a hack, given the precise location where
IsPreemtible is set, it cannot be used from
SymbolTable::handleAnonymousVersion.
I could add another method to SymbolTable if you think that would be
better.
Differential Revision: https://reviews.llvm.org/D36499
llvm-svn: 311468
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: This small patch adds the support for ! operator in linker scripts.
Reviewers: ruiu, rafael
Reviewed By: ruiu
Subscribers: meadori, grimar, emaste, llvm-commits
Differential Revision: https://reviews.llvm.org/D36451
llvm-svn: 310607
|
|
|
|
|
|
|
|
|
|
|
|
| |
D35945 introduces change when there is useless to check Error flag
in few places, but ErrorCount must be checked instead.
But then we probably can just check ErrorCount always. That should simplify
things. Patch do that.
Differential revision: https://reviews.llvm.org/D36266
llvm-svn: 310046
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Following possible scripts triggered accessing to Target when it was not yet
initialized (was nullptr).
MEMORY { name : ORIGIN = DATA_SEGMENT_RELRO_END; }
MEMORY { name : ORIGIN = CONSTANT(COMMONPAGESIZE); }
Patch errors out instead.
Differential revision: https://reviews.llvm.org/D36140
llvm-svn: 309953
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
value.
Previously we would crash when tried to ALIGN(0).
Patch uses value 1 instead in this case, that
looks to be consistent with GNU linkers
and reasonable and simple behavior itself.
Differential revision: https://reviews.llvm.org/D35942
llvm-svn: 309372
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a bit of a hack, but it is *so* convenient.
Now that we create synthetic linker scripts when none is provided, we
always have to handle paired OutputSection and OutputsectionCommand and
keep a mapping from one to the other.
This patch simplifies things by merging them and creating what used to
be OutputSectionCommands really early.
llvm-svn: 309311
|