| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
I think it is clear by now that the new linker is viable.
llvm-svn: 262158
|
|
|
|
|
|
| |
Patch from Eugene Zelenko!
llvm-svn: 247323
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Put sections to segments according to linker scripts if available.
Rework the code of TargetLayout::assignSectionsToSegments so it operates
on the given list of segments, which can be either read from linker scripts
or constructed as before.
Handle NONE segments defined in linker scripts by putting corresponding sections
to PT_NULL segment.
Consider flags set for segments through linker scripts.
Differential Revision: http://reviews.llvm.org/D10918
llvm-svn: 243002
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The function uses parallel_for() and then writes error messages from the
parallel loop's body. This produces nondetermistic error messages. Instead,
copy error messages to a vector and sort it by the atom's file offsets before
printing all error messages after the parallel_for(). This results in a few
string copies, but only in the error case. (And passing tests seem more
important than performance.)
This makes tests elf/AArch64/rel-prel16-overflow.test and
elf/AArch64/rel-prel32-overflow.test pass on Windows: Both tests check that
atom error messages are emitted in a certain order, and on Windows they
happened to be emitted in a different order before this patch.
llvm-svn: 241988
|
|
|
|
| |
llvm-svn: 241194
|
|
|
|
|
|
|
| |
Differential Revision: http://reviews.llvm.org/D9921
Reviewed by: atanasyan
llvm-svn: 237973
|
|
|
|
|
|
|
| |
This method returns _flags field which has `uint64_t` type. Now the
field's type and the method's return type are consistent.
llvm-svn: 235393
|
|
|
|
|
|
|
|
|
|
| |
The `OutputSection::appendSection()` method always gets a pointer
to the `Section` class descendants. So it is not necessary to keep them
in the vector of `Chunk` pointers.
No functional changes.
llvm-svn: 235392
|
|
|
|
| |
llvm-svn: 235391
|
|
|
|
| |
llvm-svn: 234938
|
|
|
|
|
|
| |
The size of AArch64TargetHander.cpp.o is now 4.1MB.
llvm-svn: 234931
|
|
|
|
|
|
|
|
| |
That helps to correctly write content of hash table if target and host
endianness are not the same. Right now that commit does not affect
any supported targets.
llvm-svn: 234928
|
|
|
|
|
|
|
|
|
| |
We do not need to iterate over `_buckets` and `_chains` vectors and
write all elements one by one.
No functional changes.
llvm-svn: 234927
|
|
|
|
|
|
| |
No functional changes.
llvm-svn: 234926
|
|
|
|
| |
llvm-svn: 234419
|
|
|
|
|
|
|
|
| |
Maybe we can interpret alignment 0 as "don't care", but for
consistency, it's good to set 1 instead of 0 where we allow
any alignments.
llvm-svn: 234284
|
|
|
|
| |
llvm-svn: 234070
|
|
|
|
|
|
| |
It is enough to have single TargetLayout class.
llvm-svn: 234065
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In r233772, I removed an empty class, DefaultTargetHandler, from
the class hierarchy by merging the class with TargetHandler. I then
found that TargetHandler and its base class, TargetHandlerBase,
are also almost the same.
We need to go deeper.
In this patch, I merged TargetHandlerBase with TargetHandler.
The only difference between them is the existence (or absense)
of a pure virtual function registerRelocationName(). I added that
function to the (new) TargetHandler.
One more thing is that TargetHandler was templated for no reason.
I made it non-templated class.
llvm-svn: 233773
|
|
|
|
|
|
|
|
| |
Type of `OutputSection::_type` field is int64_t. This change makes
the field's and the argument's types consistent and allows to assign
full range of values to the `OutputSection::_type` field.
llvm-svn: 233617
|
|
|
|
|
|
|
|
| |
Setting _alignment member varaible to 0 look suspicious since
the minimum alignment value is 1. I'm not going to change that
number in this patch, though.
llvm-svn: 233472
|
|
|
|
| |
llvm-svn: 233424
|
|
|
|
| |
llvm-svn: 233423
|
|
|
|
|
|
| |
Make these functions non-pure and define the default implementations.
llvm-svn: 233405
|
|
|
|
| |
llvm-svn: 233344
|
|
|
|
|
|
|
|
| |
This patch defines implicit conversion between integers and PowerOf2
instances, so uses of the classes is now implicit and look like
regular integers. Now we are ready to remove the scaffolding.
llvm-svn: 233245
|
|
|
|
|
|
|
|
|
|
| |
This patch is to make instantiation and conversion to an integer explicit,
so that we can mechanically replace all occurrences of the class with
integer in the next step.
Now get() returns an alignment value rather than its log2 value.
llvm-svn: 233242
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
N64 ABI relocation record r_info field in fact consists of five subfields:
* r_sym - symbol index
* r_ssym - special symbol
* r_type3 - third relocation type
* r_type2 - second relocation type
* r_type - first relocation type
Up to three these relocations applied one by one. The first relocation
uses an addendum from the relocation record. Each subsequent relocation
takes as its addend the result of the previous operation. Only the final
operation actually modifies the location relocated. The first relocation
uses as a reference symbol specified by the `r_sym` field. The third
relocation assumes NULL symbol.
The patch represents these data using LLD model and takes in account
additional relocation types during a relocation calculation.
Additional relocations do not introduce any new relations between two
atoms and just specify operations need to be done during a relocation
calculation. The first relocation type (`r_type`) stored in the
`Reference::_kindValue`. The rest of relocations and `r_ssym` value are
stored in the new `Reference::_tag` field "as-is". I decided to do not
"decode" these data on the core LLD level to prevent pollution of the
core LLD model by very target specific data.
Also I have to override writing of relocation records in the `RelocationTable`
class to convert MIPS N64 ABI relocation information from the `Reference`
class back to the ELF relocation record.
http://reviews.llvm.org/D8533
llvm-svn: 233057
|
|
|
|
|
|
| |
No functional changes.
llvm-svn: 232938
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changes improves performance of lld, when self-hosting lld, when compared
with the bfd linker. BFD linker on average takes 8 seconds in elapsed time.
lld takes 3 seconds elapased time average. Without this change, lld takes ~5
seconds average. The runtime comparisons were done on a release build and
measured by running linking thrice.
lld self-host without the change
----------------------------------
real 0m3.196s
user 0m4.580s
sys 0m0.832s
lld self-host with lld
-----------------------
user 0m3.024s
user 0m3.252s
sys 0m0.796s
time taken to build lld with bfd
--------------------------------
real 0m8.419s
user 0m7.748s
sys 0m0.632s
llvm-svn: 232460
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The `eh_frame_ptr` field in the `.eh_frame_hdr` section contains an address
of the `.eh_frame` section. Using an absolute 32-bit format for encoding
of this field does not work for 64-bit targets. It is better to use a
relative format because it covers both 32-bit and 64-bit cases. Sure
this work if a distance between `.eh_frame_hdr` and `.eh_frame` sections
is less than 4 Gb but it is a rather correct assumption.
http://reviews.llvm.org/D8352
llvm-svn: 232414
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit implements the behaviour of the SECTIONS linker script directive,
used to not only define a custom mapping between input and output sections, but
also order input sections in the output file. To do this, we modify
DefaultLayout with hooks at important places that allow us to re-order input
sections according to a custom order. We also add a hook in SegmentChunk to
allow us to calculate linker script expressions while assigning virtual
addresses to the input sections that live in a segment.
Not all SECTIONS constructs are currently supported, but only the ones that do
not use special sort orders. It adds two LIT test as practical examples of
which sections directives are currently supported.
In terms of high-level changes, it creates a new class "script::Sema" that owns
all linker script ASTs and the logic for linker script semantics as well.
ELFLinkingContext owns a single copy of Sema, which will be used throughout
the object file writing process (to layout sections as proposed by the linker
script).
Other high-level change is that the writer no longer uses a "const" copy of
the linking context. This happens because linker script expressions must be
calculated *while* calculating final virtual addresses, which is a very late
step in object file writing. While calculating these expressions, we need to
update the linker script symbol table (inside the semantics object), and, thus,
we are "modifying our context" as we prepare to write the file.
http://reviews.llvm.org/D8157
llvm-svn: 232402
|
|
|
|
| |
llvm-svn: 232361
|
|
|
|
|
|
|
| |
We don't want to risk to override wrong st_other bits, and when
we need to zero, we can do that explictly.
llvm-svn: 232282
|
|
|
|
| |
llvm-svn: 232251
|
|
|
|
|
|
| |
Fix ambiguous finalize function.
llvm-svn: 232250
|
|
|
|
| |
llvm-svn: 231271
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
SHF_GROUP: Group Member Sections
----------------------------------
A section which is part of a group, and is to be retained or discarded with the
group as a whole, is identified by a new section header attribute: SHF_GROUP
This section is a member (perhaps the only one) of a group of sections, and the
linker should retain or discard all or none of the members. This section must be
referenced in a SHT_GROUP section. This attribute flag may be set in any section
header, and no other modification or indication is made in the grouped sections.
All additional information is contained in the associated SHT_GROUP section.
SHT_GROUP: Section Group Definition
-------------------------------------
Represents a group section.
The section group's sh_link field identifies a symbol table section, and its
sh_info field the index of a symbol in that section. The name of that symbol is
treated as the identifier of the section group.
More information: https://mentorembedded.github.io/cxx-abi/abi/prop-72-comdat.html
Added a lot of extensive tests, that tests functionality.
llvm-svn: 230195
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When the GNU linker sees two input sections with the same name, and the name
starts with ".gnu.linkonce.", the linker will only keep one copy and discard the
other. Any section whose name starts with “.gnu.linkonce.” is a COMDAT section.
Some architectures like Hexagon use this section to store floating point constants,
that need be deduped.
This patch adds gnu.linkonce functionality to the ELFReader.
llvm-svn: 230194
|
|
|
|
|
|
|
|
|
| |
The `Elf_Rel_Impl::setSymbolAndType` method now has the third argument
`IsMips64EL` (like complement methods `getSymbol` and `getType`). While
we do not support linking of MIPS64 ELF object file just pass `false`
to the `setSymbolAndType`.
llvm-svn: 227045
|
|
|
|
|
|
|
|
|
|
|
| |
At the moment errors in relocation processing such as out of range
values are not detected or at best trapped by asserts which will not
be present in release builds. This patch adds support for checking
error return values from applyRelocation() calls and printing an
appropriate error message. It also adds support for printing multiple
errors rather than just the first one.
llvm-svn: 226557
|
|
|
|
|
|
|
| |
This class defines a relocation handler interface. The interface does
not depend on the template argument so the argument is redundant.
llvm-svn: 226259
|
|
|
|
|
|
|
|
|
| |
Some targets like microMIPS and ARM Thumb use the last bit of a symbol's
value to mark 'compressed' code. This patch adds new virtual function
`DynamicTable::getAtomVirtualAddress` which allows to adjust a symbol's
value before using it in a dynamic table tags like DT_INIT / DT_FINI.
llvm-svn: 223963
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The LLD linker searches initializer and finalizer function names
and emits DT_INIT/DT_FINI dynamic table tags to point to these symbols.
The -init/-fini command line options override initializer ("_init") and
finalizer ("_fini") function names used by default.
Now the -init/-fini options do not affect .init_array/.fini_array
sections. The corresponding code has been removed.
Differential Revision: http://reviews.llvm.org/D6578
llvm-svn: 223917
|
|
|
|
| |
llvm-svn: 223400
|
|
|
|
|
|
|
| |
To find an AtomLayout object for the given symbol I replace the
`Layout::findAtomAddrByName` method by `Layout::findAtomLayoutByName` method.
llvm-svn: 223359
|
|
|
|
|
|
| |
No change in functionality.
llvm-svn: 222975
|
|
|
|
|
|
| |
No change in functionality.
llvm-svn: 222973
|
|
|
|
|
|
| |
No change in functionality.
llvm-svn: 222972
|
|
|
|
|
|
|
|
|
| |
This reverts commit r222310.
Not sure which commit is the cause of the failure on the darwin bot. Will need
to revert my changes and commit one change at a time.
llvm-svn: 222330
|