| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In many situations, we don't want to exit at the first error even in the
process model. For example, it is better to report all undefined symbols
rather than reporting the first one that the linker picked up randomly.
In order to handle such errors, we don't need to wrap everything with
ErrorOr (thanks for David Blaikie for pointing this out!) Instead, we
can set a flag to record the fact that we found an error and keep it
going until it reaches a reasonable checkpoint.
This idea should be applicable to other places. For example, we can
ignore broken relocations and check for errors after visiting all relocs.
In this patch, I rename error to fatal, and introduce another version of
error which doesn't call exit. That function instead sets HasError to true.
Once HasError becomes true, it stays true, so that we know that there
was an error if it is true.
I think introducing a non-noreturn error reporting function is by itself
a good idea, and it looks to me that this also provides a gradual path
towards lld-as-a-library (or at least embed-lld-to-your-program) without
sacrificing code readability with lots of ErrorOr's.
http://reviews.llvm.org/D16641
llvm-svn: 259069
|
|
|
|
|
|
|
| |
Although it is syntactically correct, it is a bit confusing, and
not necessary here.
llvm-svn: 258996
|
|
|
|
|
|
|
| |
Were had very similar code for deciding to keep a local symbol and for
actually writing it.
llvm-svn: 258958
|
|
|
|
| |
llvm-svn: 258940
|
|
|
|
| |
llvm-svn: 258795
|
|
|
|
|
|
| |
This new code should be logically equivalent to the previous code.
llvm-svn: 258792
|
|
|
|
| |
llvm-svn: 258767
|
|
|
|
| |
llvm-svn: 258766
|
|
|
|
| |
llvm-svn: 258760
|
|
|
|
|
|
|
|
|
| |
This does not solve the problem that we call isGnuIFunc function
both from RelocationSection and from the Writer::scanRelocs, but
this at least should improve readability. I'm taking an incremental
approach to reduce complexity.
llvm-svn: 258753
|
|
|
|
| |
llvm-svn: 258748
|
|
|
|
|
|
|
| |
This was the only place we directly called lookup on the internal table
of the symbol table.
llvm-svn: 258724
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are a few cases where we have almost duplicated code.
This patches fixes the simplest: the finalize and write of dynamic
section. Right now they have to have exactly the same structure to
decide if a DT_* entry is needed and then to actually write it.
We cannot just write it to a std::vector in the first pass since
addresses have not been computed yet.
llvm-svn: 258723
|
|
|
|
|
|
| |
Thanks to David Blaikie who found that issue.
llvm-svn: 258707
|
|
|
|
|
|
| |
EhFrameHeader<ELFT>::assignEhFrame().
llvm-svn: 258670
|
|
|
|
|
|
|
|
|
|
| |
Summary: It looks like this snuck through in r256143/D15383.
Reviewers: ruiu, grimar
Differential Revision: http://reviews.llvm.org/D16500
llvm-svn: 258599
|
|
|
|
|
|
| |
EhFrameHeader<ELFT>::assignEhFrame().
llvm-svn: 258499
|
|
|
|
|
|
|
|
|
| |
In this code, we avoid calling needsCopyRel in writeTo because
we called that function already in scanRelocs. Making the same
decision twice is a waste and has a risk of a bug that we get
inconsistent resuts.
llvm-svn: 258430
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some MIPS relocation (for now R_MIPS_GOT16) requires creation of GOT
entries for symbol not included in the dynamic symbol table. They are
local symbols and non-local symbols with 'local' visibility. Local GOT
entries occupy continuous block between GOT header and regular GOT
entries.
The patch adds initial support for handling local GOT entries. The main
problem is allocating local GOT entries for local symbols. Such entries
should be initialized by high 16-bit of the symbol value. In ideal world
there should be no duplicated entries with the same values. But at the
moment of the `Writer::scanRelocs` call we do not know a value of the
symbol. In this patch we create new local GOT entry for each relocation
against local symbol, though we can exhaust GOT quickly. That needs to
be optimized later. When we calculate relocation we know a final symbol
value and request local GOT entry index. To do that we maintain map
between addresses and local GOT entry indexes. If we start to calculate
relocations in parallel we will have to serialize access to this map.
Differential Revision: http://reviews.llvm.org/D16324
llvm-svn: 258388
|
|
|
|
|
|
|
| |
STT_FILE symbols usually contain source file names. It is redundant
to keep this information in the output file.
llvm-svn: 258331
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Added check for terminator CIE/FDE which has zero data size.
void EHOutputSection<ELFT>::addSectionAux(
...
// If CIE/FDE data length is zero then Length is 4, this
// shall be considered a terminator and processing shall end.
if (Length == 4)
break;
...
After this "Bug 25923 - lld/ELF2 linked application crashes if exceptions were used." is fixed for me. Self link of clang also works.
Initial commit message:
[ELF] - implemented --eh-frame-hdr command line option.
--eh-frame-hdr
Request creation of ".eh_frame_hdr" section and ELF "PT_GNU_EH_FRAME" segment header.
Both gold and the GNU linker support an option --eh-frame-hdr which tell them to construct a header for all the .eh_frame sections. This header is placed in a section named .eh_frame_hdr and also in a PT_GNU_EH_FRAME segment. At runtime the unwinder can find all the PT_GNU_EH_FRAME segments by calling dl_iterate_phdr.
This section contains a lookup table for quick binary search of FDEs.
Detailed info can be found here:
http://www.airs.com/blog/archives/462
Differential revision: http://reviews.llvm.org/D15712
llvm-svn: 257889
|
|
|
|
| |
llvm-svn: 257801
|
|
|
|
|
|
| |
This reverts commit r257753 because we cannot link Clang with this patch.
llvm-svn: 257797
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
--eh-frame-hdr
Request creation of ".eh_frame_hdr" section and ELF "PT_GNU_EH_FRAME" segment header.
Both gold and the GNU linker support an option --eh-frame-hdr which tell them to construct a header for all the .eh_frame sections. This header is placed in a section named .eh_frame_hdr and also in a PT_GNU_EH_FRAME segment. At runtime the unwinder can find all the PT_GNU_EH_FRAME segments by calling dl_iterate_phdr.
This section contains a lookup table for quick binary search of FDEs.
Detailed info can be found here:
http://www.airs.com/blog/archives/462
Differential revision: http://reviews.llvm.org/D15712
llvm-svn: 257753
|
|
|
|
| |
llvm-svn: 257356
|
|
|
|
|
|
|
| |
This reverts commit r257080 because it caused GCC to emit "enumeral
and non-enumeral type in conditional expression" warning.
llvm-svn: 257096
|
|
|
|
|
|
|
| |
sh_type and sh_flags are valid names as members of ELF structs,
but they are not as variables in LLVM.
llvm-svn: 257082
|
|
|
|
| |
llvm-svn: 257081
|
|
|
|
| |
llvm-svn: 257080
|
|
|
|
|
|
| |
They happened to be anagrams.
llvm-svn: 257072
|
|
|
|
|
|
|
|
|
|
| |
Summary: This will allow us to remove the AMDGPU support from old ELF.
Reviewers: rafael, ruiu
Differential Revision: http://reviews.llvm.org/D15895
llvm-svn: 257023
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
String tables in unstripped executable files are fairly large in size.
For example, lld's executable file is about 34.4 MB in my environment,
and of which 3.5 MB is the string table. Efficiency of string table
construction matters.
Previously, the string table was built in an inefficient way. We used
StringTableBuilder to build that and enabled string tail merging,
although tail merging is not effective for the symbol table (you can
only make the string table 0.3% smaller for lld.) Tail merging is
computation intensive task and slow.
This patch eliminates string tail merging.
I changed the way of adding strings to the string table in this patch
too. Previously, strings were added using add() and the same strings
were then passed to getOffset() to get their offsets in the string table.
In this way, getOffset() needs to look up a hash table to get offsets
for given strings. This is a violation of "we look up the symbol table
(or a hash table) only once for each symbol" dogma of the new LLD's
design. Hash table lookup for long C++ mangled names is slow.
I eliminated that lookup in this patch.
In total, this patch improves link time of lld itself about 12%
(3.50 seconds -> 3.08 seconds.)
llvm-svn: 257017
|
|
|
|
|
|
| |
The name "RoundUpToAlignment" is too long compared to what it does.
llvm-svn: 256993
|
|
|
|
| |
llvm-svn: 256986
|
|
|
|
|
|
|
| |
MipsReginfoInputSection is basically just a container of Elf_Mips_Reginfo
struct. This patch makes that struct directly accessible from others.
llvm-svn: 256984
|
|
|
|
| |
llvm-svn: 256970
|
|
|
|
|
|
|
|
|
| |
The runtime linker may store a pointer to a data structure used by
debuggers.
Differential Revision: http://reviews.llvm.org/D15775
llvm-svn: 256942
|
|
|
|
| |
llvm-svn: 256903
|
|
|
|
| |
llvm-svn: 256846
|
|
|
|
| |
llvm-svn: 256844
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
right before commit. Sorry about that.
Test did not catch this either, so I`ll improve it and recommit later.
Original commit message:
[ELF] - Optimize .eh_frame section: remove CIE if all FDEs referencing it were removed.
This patch performs little optimization for eh_frame section.
If all FDE`s that referenced CIE are removed then CIE is also removed from output.
That can happen for example when dropping FDEs that point to dropped sections. Testcase showing that is included.
The same optimization was added to ld about 14 years ago: https://sourceware.org/ml/binutils/2001-12/msg00144.html, gold does not do that it seems.
Differential revision: http://reviews.llvm.org/D15564
llvm-svn: 256693
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
were removed.
This patch performs little optimization for eh_frame section.
If all FDE`s that referenced CIE are removed then CIE is also removed from output.
That can happen for example when dropping FDEs that point to dropped sections. Testcase showing that is included.
The same optimization was added to ld about 14 years ago: https://sourceware.org/ml/binutils/2001-12/msg00144.html, gold does not do that it seems.
Differential revision: http://reviews.llvm.org/D15564
llvm-svn: 256638
|
|
|
|
|
|
| |
RelocationSection<ELFT>::writeTo(). NFC.
llvm-svn: 256563
|
|
|
|
|
|
|
|
| |
OutputSectionBase already has virtual member functions.
This patch makes addSection() a virtual function to remove code
from Writer::createSections().
llvm-svn: 256436
|
|
|
|
| |
llvm-svn: 256410
|
|
|
|
| |
llvm-svn: 256404
|
|
|
|
|
|
| |
We cannot just pad with 0s as that would be a terminator mark.
llvm-svn: 256392
|
|
|
|
|
|
|
| |
Since the only missing bit was the size, I just replaced the Elf_Sym
with the size.
llvm-svn: 256384
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are 3 symbol types that a .bc can provide during lto: defined,
undefined, common.
Defined and undefined symbols have already been refactored. I was
working on common and noticed that absolute symbols would become an
oddity: They would be the only symbol type present in a .o but not in
a.bc.
Looking a bit more, other than the special section number they were only
used for special rules for computing values. In that way they are
similar to TLS, and we don't have a DefinedTLS.
This patch deletes it. With it we have a reasonable rule of the thumb
for having a symbol kind: It exists if it has special resolution
semantics.
llvm-svn: 256383
|
|
|
|
|
|
|
| |
This is similar to what was done for Undefined and opens the way for
having a symbol defined in bitcode.
llvm-svn: 256354
|