| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
| |
Previous way of accessing templated methods was a bit bulky,
Patch introduces small interface based solution.
Differential revision: https://reviews.llvm.org/D23872
llvm-svn: 280910
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch allows making section defined symbols absolute:
.foo : {
begin_foo = ABSOLUTE(.);
*(.foo)
}
Differential revision: https://reviews.llvm.org/D24135
llvm-svn: 280788
|
|
|
|
|
|
|
|
|
|
| |
Use std::regex instead of hand written matcher.
Patch based on code and ideas of Rui Ueyama.
Differential revision: https://reviews.llvm.org/D23829
llvm-svn: 280544
|
|
|
|
|
|
|
|
|
|
| |
Previously we used LayoutInputSection class to correctly assign
symbols defined in linker script. This patch removes it and uses
pointer to preceding input section in SymbolAssignment class instead.
Differential revision: https://reviews.llvm.org/D23661
llvm-svn: 280348
|
|
|
|
|
|
|
|
|
| |
Symbol assignments outside of SECTIONS command need to be created
even when SECTIONS command is not used.
Differential Revision: https://reviews.llvm.org/D23751
llvm-svn: 280252
|
|
|
|
| |
llvm-svn: 280237
|
|
|
|
|
|
|
|
|
| |
Patch removes VersionScriptParser class and moves the members to ScriptParser
It opens road for implementation of VERSION linkerscript command.
Differential revision: https://reviews.llvm.org/D23774
llvm-svn: 280212
|
|
|
|
|
|
|
|
|
|
|
| |
ADDR(section)
Return the absolute address (the VMA) of the named section.
Used in the wild, eg.: https://searchcode.com/file/53617342/arch/x86/kernel/vmlinux.lds.S
Differential revision: https://reviews.llvm.org/D23913
llvm-svn: 280070
|
|
|
|
|
|
|
|
|
|
|
| |
You can force input section alignment within an output section by using SUBALIGN. The
value specified overrides any alignment given by input sections, whether larger or smaller.
SUBALIGN is used in many projects in the wild.
Differential revision: https://reviews.llvm.org/D23063
llvm-svn: 279256
|
|
|
|
| |
llvm-svn: 279060
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The linker will normally set the LMA equal to the VMA.
You can change that by using the AT keyword.
The expression lma that follows the AT keyword specifies
the load address of the section.
Patch implements this keyword.
Differential revision: https://reviews.llvm.org/D19272
llvm-svn: 278911
|
|
|
|
|
|
| |
PT_INTERP
llvm-svn: 278781
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
functionality.
Previously filtering that was used worked incorrectly.
For example for next script it would just remove both sections completely:
SECTIONS {
. = 0x1000;
.aaa : ONLY_IF_RW { *(.aaa.*) }
. = 0x2000;
.aaa : ONLY_IF_RO { *(.aaa.*) }
}
Patch fixes above issues and adds testcase showing the issue. Testcase is a subset of
FreeBSD script which has:
.eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
...
.eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
Differential revision: https://reviews.llvm.org/D23326
llvm-svn: 278486
|
|
|
|
|
|
|
| |
We have getSectionSize for SIZEOF command. So, I think
getHeaderSize is a better name for SIZEOF_HEADERS.
llvm-svn: 278470
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, we created two or more output sections if there are
input sections with the same name but with different attributes.
That is a wrong behavior. This patch fixes the issue.
One thing we need to do is to merge output section attributes.
Currently, we create an output section based on the first input
section's attributes. This may make a wrong output section
attributes. What we need to do is to bitwise-OR attributes.
We'll do it in a follow-up patch.
llvm-svn: 278461
|
|
|
|
| |
llvm-svn: 278453
|
|
|
|
|
|
| |
Also avoid to use a lambda that is called only once.
llvm-svn: 278445
|
|
|
|
| |
llvm-svn: 278322
|
|
|
|
|
|
|
|
|
|
|
| |
SIZEOF_HEADERS - Return the size in bytes of the output file’s headers.
It is is a feature used in FreeBsd script, for example.
There is a discussion on PR28688 page about it.
Differential revision: https://reviews.llvm.org/D23165
llvm-svn: 278204
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
The comparator function to compare input sections as instructed by
SORT command was a bit too complicated because it needed to handle
four different cases. This patch split it into two function calls.
This patch also simplifies the parser.
Reviewers: grimar
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D23140
llvm-svn: 277780
|
|
|
|
|
|
| |
But always set Script<ELFT>::X->OutputSections.
llvm-svn: 277720
|
|
|
|
|
|
|
|
|
|
|
|
| |
ASSERT(exp, message)
Ensure that exp is non-zero. If it is zero, then exit the linker with an error
code, and print message.
ASSERT is useful and was seen in few projects in the wild.
Differential revision: https://reviews.llvm.org/D22912
llvm-svn: 277710
|
|
|
|
| |
llvm-svn: 277599
|
|
|
|
| |
llvm-svn: 277594
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously we supported only sorting by name.
When there are nested section sorting commands in linker script, there can be at most 1
level of nesting for section sorting commands.
SORT_BY_NAME (SORT_BY_ALIGNMENT (wildcard section pattern)). It will sort the input
sections by name first, then by alignment if 2 sections have the same name.
SORT_BY_ALIGNMENT (SORT_BY_NAME (wildcard section pattern)). It will sort the input
sections by alignment first, then by name if 2 sections have the same alignment.
SORT_BY_NAME (SORT_BY_NAME (wildcard section pattern)) is treated the same as SORT_
BY_NAME (wildcard section pattern).
SORT_BY_ALIGNMENT (SORT_BY_ALIGNMENT (wildcard section pattern)) is treated the
same as SORT_BY_ALIGNMENT (wildcard section pattern).
All other nested section sorting commands are invalid.
Patch implements that all above.
Differential revision: https://reviews.llvm.org/D23019
llvm-svn: 277583
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
SIZEOF(section)
Return the size in bytes of the named section, if that section has been allocated.
SIZEOF(section) often used in scripts. Few examples from the wild:
https://github.com/chipKIT32/pic32-Arduino-USB-Bootloader-original/blob/master/boot-linkerscript.ld
https://github.com/devkitPro/buildscripts/blob/master/dkarm-eabi/crtls/gba_cart.ld
Patch implements it.
Differential revision: https://reviews.llvm.org/D22915
llvm-svn: 277165
|
|
|
|
| |
llvm-svn: 277159
|
|
|
|
|
|
|
|
|
|
|
|
| |
When the SORT keyword is used, the linker will sort the files or sections into ascending order by name before placing them in the output file.
It is used in FreeBSD script:
https://svnweb.freebsd.org/base/head/sys/conf/ldscript.amd64?revision=284870&view=markup#l139
This is PR28689.
Differential revision: https://reviews.llvm.org/D22749
llvm-svn: 277153
|
|
|
|
| |
llvm-svn: 277116
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, Ignore flag is set if we don't want to assign
a value to symbols. It happens if a symbol assingment is in
PROVIDE() and there's already a symbol with the same name.
The previous code had a subtle but that we assume that the
existing symbol is an absolute symbol even if it is not.
This patch fixes the issue by always overwriting an absolute
symbol.
llvm-svn: 277115
|
|
|
|
| |
llvm-svn: 277102
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Scripts can contain something like:
KEEP (*crtbegin.o(.ctors))
What means that "*crtbegin.o" is a wildcard of file to take the sections from.
This is some kind of opposite to EXCLUDE_FILE and used in FreeBSD script:
https://svnweb.freebsd.org/base/head/sys/conf/ldscript.amd64?revision=284870&view=markup#l122
Patch implements this.
Differential revision: https://reviews.llvm.org/D22852
llvm-svn: 277042
|
|
|
|
|
|
|
|
|
| |
All other singleton instances are accessible globally.
CommonInputSection shouldn't be an exception.
Differential Revision: https://reviews.llvm.org/D22935
llvm-svn: 277034
|
|
|
|
| |
llvm-svn: 277023
|
|
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D22795
llvm-svn: 276825
|
|
|
|
|
|
|
|
|
|
|
| |
Output section description can contain ALIGN modificator:
https://sourceware.org/binutils/docs/ld/Output-Section-Description.html#Output-Section-Description
Patch implements it.
Differential revision: https://reviews.llvm.org/D22674
llvm-svn: 276780
|
|
|
|
| |
llvm-svn: 276717
|
|
|
|
|
|
|
|
|
|
|
| |
createSections function is getting longer, so it is time to split it
into small functions. The reason why the function is long is because
it has deeply nested for-loops. This patch constructs temporary data
to reduce nesting level.
Differential Revision: https://reviews.llvm.org/D22786
llvm-svn: 276706
|
|
|
|
| |
llvm-svn: 276697
|
|
|
|
|
|
| |
Re-commit r276543 with a fix for buildbots.
llvm-svn: 276693
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Output section description in SECTIONS looks like that:
section [address] [(type)] :
...
{
...
}
Patch implements support of address atribute.
Differential revision: https://reviews.llvm.org/D22689
llvm-svn: 276619
|
|
|
|
| |
llvm-svn: 276586
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, we handled an expression as a vector of tokens. In other
words, an expression was a vector of uncooked raw StringRefs.
When we need a value of an expression, we used ExprParser to run
the expression.
The separation was needed essentially because parse time is too
early to evaluate an expression. In order to evaluate an expression,
we need to finalize section sizes. Because linker script parsing
is done at very early stage of the linking process, we can't
evaluate expressions while parsing.
The above mechanism worked fairly well, but there were a few
drawbacks.
One thing is that we sometimes have to parse the same expression
more than once in order to find the end of the expression.
In some contexts, linker script expressions have no clear end marker.
So, we needed to recognize balanced expressions and ternary operators.
The other is poor error reporting. Since expressions are parsed
basically twice, and some information that is available at the first
stage is lost in the second stage, it was hard to print out
apprpriate error messages.
This patch fixes the issues with a new approach.
Now the expression parsing is integrated into ScriptParser.
ExprParser class is removed. Expressions are represented as lambdas
instead of vectors of tokens. Lambdas captures information they
need to run themselves when they are created.
In this way, ends of expressions are naturally detected, and
errors are handled in the usual way. This patch also reduces
the amount of code.
Differential Revision: https://reviews.llvm.org/D22728
llvm-svn: 276574
|
|
|
|
| |
llvm-svn: 276543
|
|
|
|
|
|
|
|
| |
createSections is getting longer, so it is probably time to split.
Differential Revision: https://reviews.llvm.org/D22730
llvm-svn: 276538
|
|
|
|
|
|
| |
I don't think this typedef contributes to readability.
llvm-svn: 276525
|
|
|
|
| |
llvm-svn: 276524
|
|
|
|
| |
llvm-svn: 276398
|
|
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D22660
llvm-svn: 276384
|
|
|
|
|
|
|
|
|
|
| |
LinkerScript<ELFT>::assignAddresses is becoming larger and looks
it can be good time for splitting. I expect to can more SectionsCommand's there,
and dispatching some of them separatelly can help to keep method smaller either.
Differential revision: https://reviews.llvm.org/D22506
llvm-svn: 276300
|