| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
| |
llvm-svn: 315414
|
|
|
|
|
|
|
|
|
|
| |
"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
|
|
|
|
|
|
|
|
| |
Because addRegular's functionality is tightly coupled with
addSymbol, and the former is called only once, it makes sense
to merge the two functions. This patch also adds comments.
llvm-svn: 315401
|
|
|
|
|
|
| |
I think three ctors are too many for this simple class.
llvm-svn: 315394
|
|
|
|
| |
llvm-svn: 315393
|
|
|
|
|
|
| |
This should improve consistency. Also added comment.
llvm-svn: 315169
|
|
|
|
| |
llvm-svn: 315168
|
|
|
|
| |
llvm-svn: 315167
|
|
|
|
| |
llvm-svn: 315166
|
|
|
|
| |
llvm-svn: 315164
|
|
|
|
|
|
|
|
|
|
| |
New lld's files are spread under lib subdirectory, and it isn't easy
to find which files are actually maintained. This patch moves maintained
files to Common subdirectory.
Differential Revision: https://reviews.llvm.org/D37645
llvm-svn: 314719
|
|
|
|
|
|
|
| |
This fixes two more cases where we were aligning the offset in a
section, instead of the final address.
llvm-svn: 312983
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
That is slightly more convinent as allows to store pointer on
program header entry in a more safe way.
Change was used in 2 patches currently on review.
Differential revision: https://reviews.llvm.org/D35832
llvm-svn: 309253
|
|
|
|
|
|
|
|
| |
This method is no longer being used anywhere.
Differential Revision: https://reviews.llvm.org/D35706
llvm-svn: 308706
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The assignAddresses() function accumulates state in the LinkerScript that
prevents it from being called multiple times. This change moves the state
into a separate structure AddressState that is created at the start of the
function and disposed of at the end.
CurAddressState is used rather than passing a reference to the state as a
parameter to the functions used by assignAddresses(). This is because the
getSymbolValue function needs to be executed in the context of AddressState
but it is stored in ScriptParser when AddressState is not available.
The AddressState is also used in a limited context by processCommands()
Differential Revision: https://reviews.llvm.org/D34345
llvm-svn: 307367
|
|
|
|
|
|
|
| |
It is now just after the OutputSections are created, which is as early
as it can possibly go.
llvm-svn: 307225
|
|
|
|
| |
llvm-svn: 307217
|
|
|
|
| |
llvm-svn: 307214
|
|
|
|
|
|
| |
This is a bit simpler and avoids a walk over OutputSections.
llvm-svn: 307178
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The allocateHeaders() function is called at the end of assignAddresses(), it
decides whether the ELF header and program header table can be allocated to
a PT_LOAD program header. As the function alters state, it prevents
assignAddresses() from being called multiple times.
This change splits out the call to allocateHeaders() from assignAddresses()
this will permit assignAddresses() to be called while processing range
extension thunks without trying to allocateHeaders().
Differential Revision: https://reviews.llvm.org/D34344
llvm-svn: 307131
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is probably the main patch left in unifying our intermediary
representation.
It moves the creation of default commands before section sorting. This
has the nice effect that we now have one location where we decide
where an orphan section should be placed.
Before this patch sortSections would decide the relative location of
orphan sections to other sections, but it was up to placeOrphanSection
to decide on the exact location.
We now only sort sections we created since the linker script is
already in the correct order.
llvm-svn: 305512
|
|
|
|
|
|
|
| |
This is similar to what we do for InputSections and makes them easier
to access.
llvm-svn: 305337
|
|
|
|
| |
llvm-svn: 305156
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is PR32351
Each output section may have a type. The type is a keyword in parentheses.
(https://sourceware.org/binutils/docs/ld/Output-Section-Type.html#Output-Section-Type)
This patch support only one type, it is NOLOAD.
If output section has such type, we force it to be SHT_NOBITS.
More details are available on a review page.
Differential revision: https://reviews.llvm.org/D33647
llvm-svn: 304925
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Thunks are now generated per InputSectionDescription instead of per
OutputSection. This allows created ThunkSections to be inserted directly
into InputSectionDescription.
Changes in this patch:
- Loop over InputSectionDescriptions to find relocations to Thunks
- Generate a ThunkSection per InputSectionDescription
- Remove synchronize() as we no longer need it
- Move fabricateDefaultCommands() before createThunks
Differential Revision: https://reviews.llvm.org/D33835
llvm-svn: 304887
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When linking linux kernel LLD currently reports next errors:
ld: error: unable to evaluate expression: input section .head.text has no output section assigned
ld: error: At least one side of the expression must be absolute
ld: error: At least one side of the expression must be absolute
That does not provide file/line information and overall looks unclear.
Patch adds location information to ExprValue and that allows
to provide more clear error messages.
Differential revision: https://reviews.llvm.org/D33943
llvm-svn: 304881
|
|
|
|
|
|
|
| |
This removes a mapping from OutputSection to OutputSectionCommand and
is another step in moving clearOutputSections earlier.
llvm-svn: 304821
|
|
|
|
|
|
|
| |
This removes a call to getCmd and allows us to move
clearOutputSections earlier.
llvm-svn: 304439
|
|
|
|
|
|
| |
Also needed to move clearOutputSections earlier.
llvm-svn: 304420
|
|
|
|
|
|
|
|
|
|
|
| |
We were looking up sections by name during expression evaluation. By
keeping track of forward declarations we can do the lookup during
script parsing.
Doing the lookup earlier will be more efficient when assignAddresses
is run twice and removes two uses of OutputSections.
llvm-svn: 304381
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While the following expression is handled fine:
PROVIDE_HIDDEN(newsym = oldsym + address);
The following expression triggers an error because the expression
is evaluated as absolute:
PROVIDE_HIDDEN(newsym = ALIGN(oldsym, CONSTANT(MAXPAGESIZE)) + address);
To avoid this error, we use late evaluation for ALIGN by making the
alignment an attribute of the expression itself.
Differential Revision: https://reviews.llvm.org/D33629
llvm-svn: 304185
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reduces how many times we have to map from OutputSection to
OutputSectionCommand. It is a required step to moving
clearOutputSections earlier.
In order to always use writeTo in OutputSectionCommand we have to call
fabricateDefaultCommands for -r links and move section compression
after it.
llvm-svn: 303784
|
|
|
|
|
|
|
|
|
| |
By the time we get to linker scripts, all special InputSectionBase
should have been combined into synthetic sections, which are a type of
InputSection. The net result is that we can use InputSection in a few
places that were using InputSectionBase.
llvm-svn: 303702
|
|
|
|
|
|
| |
This improves many-sections.s with a linker script from 22s to 0.9s.
llvm-svn: 302708
|
|
|
|
|
|
| |
We now always use getCmd. I will optimize it in a followup commit.
llvm-svn: 302706
|
|
|
|
|
|
| |
We used to inherit from it, but don't need it anymore.
llvm-svn: 302675
|
|
|
|
| |
llvm-svn: 302671
|
|
|
|
| |
llvm-svn: 302662
|
|
|
|
|
|
| |
This is just faster and avoids using names.
llvm-svn: 302661
|
|
|
|
|
|
|
|
|
| |
We can set SectionIndex tentatively as we process the linker script
instead of looking it repeatedly.
In general we should try to have as few name lookups as possible.
llvm-svn: 302299
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the non linker script case we would try very early to find out if
we could allocate the headers. Failing to do that would add extra
alignment to the first ro section, since we would set PageAlign
thinking it was the first section in the PT_LOAD.
In the linker script case the header allocation must be done in the
end, causing some duplication.
We now tentatively add the headers to the first PT_LOAD and if it
turns out they don't fit, remove them. With this we only need to
allocate the headers in one place in the code.
llvm-svn: 302186
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We were correctly computing the size contribution of a .tbss input
section (it is none), but we were incorrectly considering the
alignment of the output section: it was advancing Dot instead of
ThreadBssOffset.
As far as I can tell this was always wrong in our linkerscript
implementation, but that became more visible now that the code is
shared with the non linker script case.
llvm-svn: 302107
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This version uses a set to speed up the synchronize method.
Original message:
Remove LinkerScript::flush.
This patch replaces flush with a last ditch attempt at synchronizing
the section list with the linker script "AST".
The synchronization is a bit of a hack and should in time be avoided
by creating the AST earlier so that modifications can be made directly
to it instead of modifying the section list and synchronizing it back.
This is the main step for fixing
https://bugs.llvm.org/show_bug.cgi?id=32816. With this in place I
think the only missing thing would be to have processCommands assign
section indexes as dummy offsets so that the sort in
OutputSection::finalize works.
With this LinkerScript::assignAddresses becomes much simpler, which
should help with the thunk work.
llvm-svn: 301745
|
|
|
|
|
|
|
|
| |
This reverts commit r301678 since that change significantly slowed
down the linker. Before this patch, LLD could link clang in 8 seconds,
but with this patch it took 40 seconds.
llvm-svn: 301709
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch replaces flush with a last ditch attempt at synchronizing
the section list with the linker script "AST".
The synchronization is a bit of a hack and should in time be avoided
by creating the AST earlier so that modifications can be made directly
to it instead of modifying the section list and synchronizing it back.
This is the main step for fixing
https://bugs.llvm.org/show_bug.cgi?id=32816. With this in place I
think the only missing thing would be to have processCommands assign
section indexes as dummy offsets so that the sort in
OutputSection::finalize works.
With this LinkerScript::assignAddresses becomes much simpler, which
should help with the thunk work.
llvm-svn: 301678
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change fabricates linker script commands for the case where there is
no linker script SECTIONS to control address assignment. This permits us
to have a single Script->assignAddresses() function.
There is a small change in user-visible-behavior with respect to the
handling of .tbss SHT_NOBITS, SHF_TLS as the Script->assignAddresses()
requires setDot() to be called with monotically increasing addresses.
The tls-offset.s test has been updated so that the script and non-script
results match.
This change should make the non-script behavior of lld closer to an
equivalent linker script.
Differential Revision: https://reviews.llvm.org/D31888
llvm-svn: 300687
|