| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This follows up on r321889 where writing of Elf_Rel addends was partially
moved to RelocationBaseSection. This patch ensures that the addends are
always written to the output section when a input section uses RELA but the
output is REL.
Differential Revision: https://reviews.llvm.org/D42843
llvm-svn: 325328
|
|
|
|
|
|
| |
Extracted from a patch by Alexander Richardson!
llvm-svn: 325016
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
While trying to make a linker script behave the same way with lld as it did
with bfd, I discovered that lld currently doesn't diagnose overlapping
output sections. I was getting very strange runtime failures which I
tracked down to overlapping sections in the resulting binary. When linking
with ld.bfd overlapping output sections are an error unless
--noinhibit-exec is passed and I believe lld should behave the same way
here to avoid surprising crashes at runtime.
The patch also uncovered an errors in the tests: arm-thumb-interwork-thunk
was creating a binary where .got.plt was placed at an address overlapping
with .got.
Reviewers: ruiu, grimar, rafael
Reviewed By: ruiu
Differential Revision: https://reviews.llvm.org/D41046
llvm-svn: 323856
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Symbol had both Visibility and getVisibility() and they had different
meanings. That is just too easy to get wrong.
getVisibility() would compute the visibility of a particular symbol
(foo in bar.o), and Visibility stores the computed value we will put
in the output.
There is only one case when we want what getVisibility() provides, so
inline it.
llvm-svn: 322590
|
|
|
|
| |
llvm-svn: 322580
|
|
|
|
|
|
|
|
|
|
| |
When we have --icf=safe we should be able to define --icf=all as a
shorthand for --icf=safe --ignore-function-address-equality.
For now --ignore-function-address-equality is used only to control
access to non preemptable symbols in shared libraries.
llvm-svn: 322152
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This splits relocation processing in two steps.
First, analyze what needs to be done at the relocation spot. This can
be a constant (non preemptible symbol, relative got reference, etc) or
require a dynamic relocation. At this step we also consider creating
copy relocations.
Once that is done we decide if we need a got or a plt entry.
The code is simpler IMHO. For example:
- There is a single call to isPicRel since the logic is not split
among adjustExpr and the caller.
- R_MIPS_GOTREL is simple to handle now.
- The tracking of what is preemptible or not is much simpler now.
This also fixes a regression with symbols being both in a got and copy
relocated. They had regressed in r268668 and r268149.
The other test changes are because of error messages changes or the
order of two relocations in the output.
llvm-svn: 322047
|
|
|
|
|
|
|
|
|
|
| |
The body of the in scanRelocs is fairly big. This moves it to its own
function.
It is not a big readability win by itself, but should help further
refactoring.
llvm-svn: 322035
|
|
|
|
|
|
| |
This is possible now that getSize is not a template.
llvm-svn: 321900
|
|
|
|
|
|
|
| |
This merges the two places were we check Config->IsRela to decide how
to write a relocation addend.
llvm-svn: 321889
|
|
|
|
| |
llvm-svn: 321780
|
|
|
|
| |
llvm-svn: 321772
|
|
|
|
| |
llvm-svn: 321769
|
|
|
|
| |
llvm-svn: 321768
|
|
|
|
| |
llvm-svn: 321738
|
|
|
|
| |
llvm-svn: 321737
|
|
|
|
| |
llvm-svn: 321736
|
|
|
|
| |
llvm-svn: 321734
|
|
|
|
|
|
|
| |
We normally add checks on the architecture independent Expr instead of
on the architecture dependent relocation type.
llvm-svn: 321733
|
|
|
|
| |
llvm-svn: 321688
|
|
|
|
|
|
|
| |
If a section is RW there is no reason to drop a relocation with a weak
undefined symbol.
llvm-svn: 321684
|
|
|
|
|
|
|
|
|
|
| |
This makes adjustExpr a bit simpler too IMHO.
It seems that some of the complication around relocation processing
is that we are trying to create copy relocations too early. It seems
we could handle a few simple cases first and continue.
llvm-svn: 321507
|
|
|
|
|
|
| |
I will send a followup patch removing the FIXME this patch adds.
llvm-svn: 321499
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously we failed to resolve them when produced executables:
"relocation R_X86_64_32 cannot be used against shared object; recompile with -fPIC"
Patch fixes it so that we resolve them to 0 for executables.
And for -shared case we still should produce the relocation.
This finishes fixing PR35720.
DIfferential revision: https://reviews.llvm.org/D41551
llvm-svn: 321473
|
|
|
|
|
|
|
|
|
|
|
| |
If a relocation cannot be implemented by the dynamic linker and the
section is rw, allow creating a plt entry to use as the function
address as if the section was ro.
This matches bfd and gold. It also matches our behavior with -z
notext.
llvm-svn: 321430
|
|
|
|
|
|
|
|
|
|
| |
We normally avoid "switch (Config->EKind)", but in this case I think
it is worth it.
It is only executed when there is an error and it allows detemplating
a lot of code.
llvm-svn: 321404
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is part of PR35720.
Currently LLD allows dynamic relocations against text when -z notext is given.
Though for non-PIC relocations like R_X86_64_PC32 that does not work,
we produce "relocation R_X86_64_PC32 cannot be used against shared object;"
error because they may overflow in runtime.
Solution implemented is to use PLT for them.
Differential revision: https://reviews.llvm.org/D41541
llvm-svn: 321400
|
|
|
|
|
|
|
|
|
| |
It is a pretty expensive function. Some of the speedups:
clang: 1.92%
chrome: 1.15%
linux-kernel: 1.40%
llvm-svn: 321311
|
|
|
|
|
|
| |
Every shared symbol has a file, so we can use a reference.
llvm-svn: 321187
|
|
|
|
|
|
|
|
| |
It is not necessary and matches what bfd and gold do.
This was a regression from r315658.
llvm-svn: 321023
|
|
|
|
| |
llvm-svn: 320327
|
|
|
|
| |
llvm-svn: 320324
|
|
|
|
|
|
|
| |
They were not used in InputFiles.h and it was getting too easy to add
circular includes.
llvm-svn: 320256
|
|
|
|
|
|
|
|
|
|
| |
This reduces total allocations when linking clang fsds from 263.21MB
to 174.62MB.
This also has some very nice speed improvements on some
benchmarks. Chromium and clang fsds link 6% faster.
llvm-svn: 319976
|
|
|
|
|
|
|
| |
This is a constructed testcase I noticed while working on another
patch.
llvm-svn: 319874
|
|
|
|
|
|
|
| |
We are already paying the cost of storing a InputFile in every
Symbol, so use it uniformly.
llvm-svn: 319378
|
|
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D40571
llvm-svn: 319221
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This includes a fix to mark copy reloc aliases as used.
Original message:
[ELF] Do not keep symbols if they referenced only from discarded sections.
This patch also ensures that in case of "--as-needed" is used,
DT_NEEDED entries are not created if they are required only by
these eliminated symbols.
llvm-svn: 319215
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
The bug triggers when the following conditions are met:
- A thunk is created in a given input section S
- A linker script is specified
- There is at least one matcher in the linker script .text section output
that does not match any of the sections in the input files, before the matcher
that matches section S.
The issue was found when linking the FreeBSD kernel for MIPS when built
with -fPIC. Patch by Alfredo Mazzinghi.
Reviewers: ruiu, psmith, atanasyan
Reviewed By: ruiu
Subscribers: peter.smith, emaste, sdardis, krytarowski, llvm-commits
Differential Revision: https://reviews.llvm.org/D40174
llvm-svn: 318653
|
|
|
|
|
|
|
|
| |
The ISR in the comment should read ISD for InputSectionDescription. The use
of ISR (InputSectionRange) was from the original implementation that did not
use the sections from InputSectionDescription directly.
llvm-svn: 317469
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is PR34826.
Currently LLD is unable to report line number when reporting
duplicate declaration of some variable.
That happens because for extracting line information we always use
.debug_line section content which describes mapping from machine
instructions to source file locations, what does not help for
variables as does not describe them.
In this patch I am taking the approproate information about
variables locations from the .debug_info section.
Differential revision: https://reviews.llvm.org/D38721
llvm-svn: 317080
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
Since we now only check st_value, we have to consider the case where
the section index is special.
llvm-svn: 316928
|
|
|
|
|
|
|
| |
Finding aliases for shared symbols doesn't need st_shndx because
we can just compare st_value.
llvm-svn: 316848
|
|
|
|
|
|
|
| |
This change allows us to use less templates for Shared symbol and
the functions that deals with shared symbols.
llvm-svn: 316841
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change allows Thunks to be added on multiple passes. To do this we must
merge only the thunks added in each pass, and deal with thunks that have
drifted out of range of their callers.
A thunk may end out of range of its caller if enough thunks are added in
between the caller and the thunk. To handle this we create another thunk.
Differential Revision: https://reviews.llvm.org/D34692
llvm-svn: 316754
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change adds initial support for range extension thunks. All thunks must
be created within the first pass so some corner cases are not supported. A
follow up patch will add support for multiple passes.
With this change the existing tests arm-branch-error.s and
arm-thumb-branch-error.s now no longer fail with an out of range branch.
These have been renamed and tests added for the range extension thunk.
Differential Revision: https://reviews.llvm.org/D34691
llvm-svn: 316752
|