| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adding all libcall symbols to the link can have undesired consequences.
For example, the libgcc implementation of __sync_val_compare_and_swap_8
on 32-bit ARM pulls in an .init_array entry that aborts the program if
the Linux kernel does not support 64-bit atomics, which would prevent
the program from running even if it does not use 64-bit atomics.
This change makes it so that we only add libcall symbols to the
link before LTO if we have to, i.e. if the symbol's definition is in
bitcode. Any other required libcall symbols will be added to the link
after LTO when we add the LTO object file to the link.
Differential Revision: https://reviews.llvm.org/D50475
llvm-svn: 339301
|
|
|
|
|
|
|
|
|
|
| |
There are following symbols currently available:
DefinedKind, SharedKind, UndefinedKind, LazyArchiveKind, LazyObjectKind.
Our code calls getSize() only for first two and there
seems to be no reason to return 0 for the rest.
llvm-svn: 337265
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If a symbol with an undefined version in a DSO is not going to be
exported into the dynamic symbol table then do not give an error message
for the missing version. This can happen with the --exclude-libs option
which implicitly gives all symbols in a static library the local version.
This matches the behavior of ld.gold and is exploited by the Bionic
dynamic linker on Arm.
Differential Revision: https://reviews.llvm.org/D43126
llvm-svn: 332224
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is slightly simpler to read IMHO. Now if a symbol has a position
in the file, it is Defined.
The main motivation is that with this a SharedSymbol doesn't need a
section, which reduces the size of SymbolUnion.
With this the peak allocation when linking chromium goes from 568.1 to
564.2 MB.
llvm-svn: 330966
|
|
|
|
|
|
|
|
|
| |
It was always an offset of PltIndex.
This doesn't reduce the size of the structures, but makes it easier to
do so in a followup patch.
llvm-svn: 330953
|
|
|
|
| |
llvm-svn: 330892
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before this patch:
Symbol 56
Defined 80
Undefined 56
SharedSymbol 88
LazyArchive 72
LazyObject 56
With this patch
Symbol 48
Defined 72
Undefined 48
SharedSymbol 80
LazyArchive 64
LazyObject 48
The result is that peak allocation when linking chromium (according to
heaptrack) goes from 578 to 568 MB.
llvm-svn: 330874
|
|
|
|
|
|
|
| |
This is not a big simplification right now, but the special cases for
lazy symbols have been a common source of bugs in the past.
llvm-svn: 330869
|
|
|
|
|
|
|
|
|
|
| |
Now that we don't ICF synthetic sections, we can go back to the old
logic on whose responsibility it is to check Repl.
The idea is that Sec->something() will not check Repl. It is the
responsibility of the caller to find the correct Sec.
llvm-svn: 330346
|
|
|
|
|
|
|
|
|
|
| |
We had a single symbol using -1 with a synthetic section. It is
simpler to just update its value.
This is not a big will by itself, but will allow having a simple
getOffset for InputSeciton.
llvm-svn: 330340
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds profile guided layout using the Call-Chain Clustering (C³) heuristic
from https://research.fb.com/wp-content/uploads/2017/01/cgo2017-hfsort-final1.pdf .
RFC: [llvm-dev] [RFC] Profile guided section layout
http://lists.llvm.org/pipermail/llvm-dev/2017-June/114178.html
Pass `--call-graph-ordering-file <file>` to read a call graph profile where each
line has the format:
<from symbol> <to symbol> <call count>
Differential Revision: https://reviews.llvm.org/D36351
llvm-svn: 330234
|
|
|
|
|
|
|
|
|
| |
Patch removes Lazy class which
is just an excessive layer.
Differential revision: https://reviews.llvm.org/D45083
llvm-svn: 329086
|
|
|
|
|
|
|
|
| |
They are to pull out an object file for a symbol, but for a historical
reason the code is written in two separate functions. This patch
merges them.
llvm-svn: 329039
|
|
|
|
| |
llvm-svn: 329034
|
|
|
|
|
|
| |
There were a few too many places duplicating this.
llvm-svn: 328402
|
|
|
|
|
|
|
|
| |
Since SectionBase::getOutputSection handles ICF replaces and
SectionBase::getOffset was handling it in some cases, it is more
consistent to have getOffset always handle it.
llvm-svn: 328391
|
|
|
|
|
|
|
| |
SectionBase::getOutputSection handles replacement sections, so this
code doesn't have to.
llvm-svn: 328390
|
|
|
|
|
|
|
| |
The code for computing the offset of an entry in the plt is simple,
but it was duplicated in quite a few places.
llvm-svn: 327536
|
|
|
|
|
|
|
|
|
| |
The profailing style in lld seem to be to not include such empty lines.
Clang-tidy/clang-format seem to handle this just fine.
Differential Revision: https://reviews.llvm.org/D43528
llvm-svn: 325629
|
|
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D42865
llvm-svn: 324145
|
|
|
|
|
|
|
| |
This small function was showing up in the profile. Defining it inline
gives about 0.3% speedup.
llvm-svn: 321317
|
|
|
|
|
|
| |
It is never null.
llvm-svn: 321198
|
|
|
|
| |
llvm-svn: 321196
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It is currently in InputSectionBase. Only InputSections are used in
ICF, so Repl should be move to InputSection to clear the class
hierarchy or, like this patch does, to SectionBase for convenience.
The convenience of having it on the base class is that we can just
access the replacement without having to first check if it is an
InputSection. It is a bit less code and a bit faster as some of this
code is very hot.
I got up to 1.77% improvement in clang-gdb-index and no regressions
according to lnt.
llvm-svn: 320654
|
|
|
|
|
|
|
|
|
|
|
|
| |
Having a SectionBase method check Repl is inconsistent with how we
handle other section information.
For example, if a section is replaced, Sec->Live is false and it is
natural for Sec->getOutputSection() to be null.
It is the symbol that is moved to the replacement section.
llvm-svn: 320599
|
|
|
|
|
|
|
|
| |
Looks like all tests pass without this `isLocal()`.
Differential Revision: https://reviews.llvm.org/D39780
llvm-svn: 319395
|
|
|
|
|
|
|
| |
We are already paying the cost of storing a InputFile in every
Symbol, so use it uniformly.
llvm-svn: 319378
|
|
|
|
|
|
|
| |
It was only used for --wrap and I don't think the fields with special
treatment had a meaningful impact on that feature.
llvm-svn: 319265
|
|
|
|
|
|
| |
This is simpler and matches bfd's behavior on the changed test.
llvm-svn: 319248
|
|
|
|
|
|
| |
Copying the binding seems reasonable and matches the bfd behavior.
llvm-svn: 319196
|
|
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D40530
llvm-svn: 319138
|
|
|
|
|
|
|
|
|
| |
We have a lot of "if (MIPS)" conditions in lld because the MIPS' ABI
is different at various places than other arch's ABIs at where it
don't have to be different, but we at least want to reduce MIPS-ness
from the regular classes.
llvm-svn: 317525
|
|
|
|
|
|
| |
This function is now equivalent to isDefined().
llvm-svn: 317449
|
|
|
|
|
|
|
|
|
| |
Now that DefinedRegular is the only remaining derived class of
Defined, we can merge the two classes.
Differential Revision: https://reviews.llvm.org/D39667
llvm-svn: 317448
|
|
|
|
|
|
|
|
|
| |
Common symbols are now represented with a DefinedRegular that points
to a BssSection, even during symbol resolution.
Differential Revision: https://reviews.llvm.org/D39666
llvm-svn: 317447
|
|
|
|
|
|
|
|
|
|
| |
This patch is mechanically created by
sed -i -e s/Body/Sym/g lld/ELF/*.{cpp,h}
and clang-format-diff.
llvm-svn: 317392
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now that we have only SymbolBody as the symbol class. So, "SymbolBody"
is a bit strange name now. This is a mechanical change generated by
perl -i -pe s/SymbolBody/Symbol/g $(git grep -l SymbolBody lld/ELF lld/COFF)
nd clang-format-diff.
Differential Revision: https://reviews.llvm.org/D39459
llvm-svn: 317370
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
SymbolBody and Symbol were separated classes due to a historical reason.
Symbol used to be a pointer to a SymbolBody, and the relationship
between Symbol and SymbolBody was n:1.
r2681780 changed that. Since that patch, SymbolBody and Symbol are
allocated next to each other to improve memory locality, and they have
1:1 relationship now. So, the separation of Symbol and SymbolBody no
longer makes sense.
This patch merges them into one class. In order to avoid updating too
many places, I chose SymbolBody as a unified name. I'll rename it Symbol
in a follow-up patch.
Differential Revision: https://reviews.llvm.org/D39406
llvm-svn: 317006
|
|
|
|
|
|
|
| |
This change allows us to use less templates for Shared symbol and
the functions that deals with shared symbols.
llvm-svn: 316841
|
|
|
|
| |
llvm-svn: 316811
|
|
|
|
|
|
|
|
|
|
|
|
| |
DSO is short for dynamic shared object, so the function name was a
little confusing because it sounded like it didn't work when we were
a creating statically-linked executable or something.
What we mean by "DSO" here is the current output file that we are
creating. Thus the new name. Alternatively, we could call it the current
ELF module, but "module" is a overloaded word, so I avoided that.
llvm-svn: 316809
|
|
|
|
|
|
|
| |
One case I was not sure was lazy symbols. bfd skips them completely,
but that is probably an artifact of how they implement archives.
llvm-svn: 316782
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
The COFF linker and the ELF linker have long had similar but separate
Error.h and Error.cpp files to implement error handling. This change
introduces new error handling code in Common/ErrorHandler.h, changes the
COFF and ELF linkers to use it, and removes the old, separate
implementations.
Reviewers: ruiu
Reviewed By: ruiu
Subscribers: smeenai, jyknight, emaste, sdardis, nemanjai, nhaehnle, mgorny, javed.absar, kbarton, fedor.sergeev, llvm-commits
Differential Revision: https://reviews.llvm.org/D39259
llvm-svn: 316624
|
|
|
|
| |
llvm-svn: 316455
|
|
|
|
| |
llvm-svn: 315675
|
|
|
|
|
|
|
| |
IsLocal member is initialized by the constructor and will never change.
So we don't want to make it directly accessible.
llvm-svn: 315667
|
|
|
|
| |
llvm-svn: 315664
|
|
|
|
|
|
|
|
|
| |
Convert all common symbols to regular symbols after scan.
This means that the downstream code does not to handle common symbols as a special case.
Differential Revision: https://reviews.llvm.org/D38137
llvm-svn: 314495
|
|
|
|
|
|
| |
This patch is to improve code readability.
llvm-svn: 314089
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes pr34301.
As the bug points out, we want to keep some relocations with undefined
weak symbols. This means that we cannot always claim that these
symbols are not preemptible as we do now.
Unfortunately, we cannot also just always claim that they are
preemptible. Doing so would, for example, cause us to try to create a
plt entry when we don't even have a dynamic symbol table.
What almost works is to say that weak undefined symbols are
preemptible if and only if we have a dynamic symbol table. Almost
because we don't want to fail the build trying to create a copy
relocation to a weak undefined.
llvm-svn: 313372
|