| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
| |
Traditionally, it has been defined in crtbegin.o, which is typically
provided by libgcc or as part of the C library on some systems. However,
but there's no principled reason for it to be there. We optionaly
define this symbol, which can be used on platforms that don't provide
__dso_handle in crtbegin.o or which don't use crtbegin.o at all.
Differential Revision: https://reviews.llvm.org/D33856
llvm-svn: 304732
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
decompression when using -r
This is PR33289.
Previously LLD leaved section naming as is and that lead to wrong result,
because we decompress sections when using -r,
and hence should remove ".z" prefix.
Differential revision: https://reviews.llvm.org/D33885
llvm-svn: 304711
|
|
|
|
|
|
|
|
|
|
| |
This change alters the sorting for OutputSections with the SHF_LINK_ORDER
flag in OutputSection::finalize() to use the InputSectionDescription
representation and not the OutputSection::Sections representation.
Differential revision: https://reviews.llvm.org/D33772
llvm-svn: 304700
|
|
|
|
|
|
| |
This allows moving clearOutputSections a bit earlier.
llvm-svn: 304654
|
|
|
|
|
|
|
| |
This allows us to remove the PageAlign field. It will also allow
moving fabricateDefaultCommands earlier.
llvm-svn: 304513
|
|
|
|
|
|
|
| |
This removes a call to getCmd and allows us to move
clearOutputSections earlier.
llvm-svn: 304439
|
|
|
|
|
|
|
|
| |
This is probably the correct location for it: next to
fabricateDefaultCommands. If we don't have a linker script, we
fabricate one. If we have one, we patch it.
llvm-svn: 304436
|
|
|
|
|
|
|
| |
Now it is as early as it can go: just before synchronize. We now have
to move synchronize earlier too.
llvm-svn: 304434
|
|
|
|
|
|
|
| |
I don't have a testcase in mind, but there is no reason to have the
linker script out of sync during a -r link.
llvm-svn: 304433
|
|
|
|
|
|
| |
Also needed to move clearOutputSections earlier.
llvm-svn: 304420
|
|
|
|
|
|
| |
This is needed to move clearOutputSections earlier.
llvm-svn: 304419
|
|
|
|
|
|
|
| |
The sections are ordered, so we can just use the first one when
looking for the lowest address.
llvm-svn: 304369
|
|
|
|
| |
llvm-svn: 304368
|
|
|
|
|
|
|
| |
Another step into merging the linker script and non linker script code
paths.
llvm-svn: 304339
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before InputSectionBase had an OutputSection pointer, but that was not
always valid. For example, if it was a merge section one actually had
to look at MergeSec->OutSec.
This was brittle and caused bugs like the one fixed by r304260.
We now have a single Parent pointer that points to an OutputSection
for InputSection, but to a SyntheticSection for merge sections and
.eh_frame. This makes it impossible to accidentally access an invalid
OutSec.
llvm-svn: 304338
|
|
|
|
|
|
|
|
|
|
| |
When there is a linker script with .ARM.exidx in the SECTIONS
command we must add the .ARM.exidx sentinel section to the
InputSectionDescriptions as well as to OutputSection::Sections.
Differential Revision: https://reviews.llvm.org/D33496
llvm-svn: 304206
|
|
|
|
| |
llvm-svn: 304182
|
|
|
|
|
|
|
|
|
|
| |
Now that we are trying to use the linker script representation as the
canonycal one, there are a few loops looking for just OutputSectionCommands.
Create a vector with just the OutputSectionCommands once that is
stable to simplify the rest of the code.
llvm-svn: 304181
|
|
|
|
|
|
| |
After fabricateDefaultCommands we can look at the script commands.
llvm-svn: 304014
|
|
|
|
|
|
| |
This is a necessary step for moving clearOutputSections earlier.
llvm-svn: 304009
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On SPARC, .plt is both writeable and executable. The current way
sections are sorted means that lld puts it after .data/.bss. but it
really needs to be close to .test to make sure branches into .plt
don't overflow. I'd argue that because .bss is supposed to come last
on all architectures, we should change the default sort order such
that writable and executable sections come before sections that are
just writeable. read-only executable sections should still come after
sections that are just read-only of course. This diff makes this
change.
llvm-svn: 304008
|
|
|
|
| |
llvm-svn: 303961
|
|
|
|
| |
llvm-svn: 303958
|
|
|
|
|
|
|
| |
In this way, the content and the flag is always consistent, which I
think better than removing the bit when input sections reaches the Writer.
llvm-svn: 303926
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 303781
|
|
|
|
|
|
|
|
|
|
|
| |
Once the dummy linker script is created, we want it to be used for
everything to avoid having two redundant representations that can get
out of sync.
We were already clearing OutputSections. With this patch we clear the
Sections vector of every OutputSection.
llvm-svn: 303703
|
|
|
|
|
|
|
|
|
|
| |
This converts the last (chronologically) user of OutputSections to use
the linker script commands instead.
The idea is to convert all uses after fabricateDefaultCommands, so
that we have a single representation.
llvm-svn: 303384
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
GetSection is a template because write calls relocate.
relocate has two parts. The non alloc code really has to be a
template, as it is looking a raw input file data.
The alloc part is only a template because of getSize.
This patch folds the value of getSize early, detemplates
getRelocTargetVA and splits relocate into a templated non alloc case
and a regular function for the alloc case. This has the nice advantage
of making sure we collect all the information we need for relocations
before getting to InputSection::relocateNonAlloc.
Since we know got is alloc, it can just call the function directly and
avoid the template.
llvm-svn: 303355
|
|
|
|
|
|
| |
Thanks to Andrew Ng for noticing it.
llvm-svn: 303354
|
|
|
|
|
|
|
|
|
| |
Nothing special here, just detemplates code that became possible
to detemplate after recent commits in a straghtforward way.
Differential revision: https://reviews.llvm.org/D33234
llvm-svn: 303237
|
|
|
|
|
|
| |
Follow up for r303150.
llvm-svn: 303153
|
|
|
|
|
|
|
|
|
|
| |
SymbolTableBaseSection was introduced.
Detemplation of SymbolTableSection should allow to detemplate more things.
Differential revision: https://reviews.llvm.org/D33124
llvm-svn: 303150
|
|
|
|
|
|
|
|
|
|
|
| |
Switch to llvm::to_integer() everywhere in LLD instead of
StringRef::getAsInteger() because API of latter is confusing.
It returns true on error and false otherwise what makes reading
the code incomfortable.
Differential revision: https://reviews.llvm.org/D33187
llvm-svn: 303149
|
|
|
|
| |
llvm-svn: 302921
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We used to place orphans by just using compareSectionsNonScript.
Then we noticed that since linker scripts can use another order, we
should first try match the section to a given PT_LOAD. But there is
nothing special about PT_LOAD. The same issue can show up for
PT_GNU_RELRO for example.
In general, we have to search for the most similar section and put the
orphan next to it. Most similar being defined as how long they follow
the same code path in compareSecitonsNonScript.
That is what this patch does. We now compute a rank for each output
section, with a bit for each branch in what was
compareSectionsNonScript.
With this findOrphanPos is now fully general and orphan placement can
be optimized by placing every section with the same rank at once.
The included testcase is a variation of many-sections.s that uses
allocatable sections to avoid the fast path in the existing
code. Without threads it goes form 46 seconds to 0.9 seconds.
llvm-svn: 302903
|
|
|
|
| |
llvm-svn: 302849
|
|
|
|
| |
llvm-svn: 302848
|
|
|
|
| |
llvm-svn: 302847
|
|
|
|
|
|
| |
This is a bit hackish, but allows for a lot of followup cleanups.
llvm-svn: 302845
|
|
|
|
| |
llvm-svn: 302843
|
|
|
|
| |
llvm-svn: 302832
|
|
|
|
| |
llvm-svn: 302828
|
|
|
|
| |
llvm-svn: 302826
|
|
|
|
|
|
|
|
|
|
| |
This behavior differs from the semantics implemented by GNU linkers
which only define this symbol iff ELF headers are in the memory
mapped segment.
Differential Revision: https://reviews.llvm.org/D33019
llvm-svn: 302687
|
|
|
|
| |
llvm-svn: 302662
|
|
|
|
|
|
|
|
| |
This is a bit easier to read and a lot faster in some cases. A version
of many-sections.s with linker scripts goes from 0m41.232s to
0m19.575s.
llvm-svn: 302528
|
|
|
|
|
|
|
| |
The code following this one already considers every possible insertion
point for orphan sections, there is no point in sorting them before.
llvm-svn: 302441
|
|
|
|
|
|
|
|
|
| |
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
|