| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
| |
@indntpoff is similar to @gotntpoff, but for use in position dependent code. While @gotntpoff resolves to GOT slot address relative to the
start of the GOT in the movl or addl instructions, @indntpoff resolves to the
absolute GOT slot address. ("ELF Handling For Thread-Local Storage", Ulrich Drepper).
Differential revision: http://reviews.llvm.org/D15494
llvm-svn: 255884
|
| |
|
|
|
|
|
|
|
|
|
|
| |
eh_frame.
Ian Lance Taylor writes: "Read 4 bytes. If they are not 0xffffffff, they are the length of the CIE or FDE record. Otherwise the next 64 bits holds the length, and this is a 64-bit DWARF format. This is like .debug_frame." (http://www.airs.com/blog/archives/460), that also consistent with spec (https://refspecs.linuxfoundation.org/LSB_3.0.0/LSB-PDA/LSB-PDA/ehframechpt.html).
Patch implements support of described extended length field and also adds few more checks for safety.
Differential revision: http://reviews.llvm.org/D15532
llvm-svn: 255883
|
| |
|
|
|
|
|
|
|
|
|
| |
negDelta32 is only ever implicitly generated as the FDE->CIE reference.
We therefore don't emit a relocation for it in the object file in -r mode.
The value we write in to the FDE location therefore needs to point to the
final target address of the CIE, and not the inAtomAddress as it was currently
doing.
llvm-svn: 255835
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The `_gp_disp` is a magic symbol designates offset between start of
function and gp pointer into GOT. Only `R_MIPS_HI16` and `R_MIPS_LO16`
relocations are permitted with `_gp_disp`. The patch adds the `_gp_disp`
as an ignored symbol and adjusts symbol value before call the `relocateOne`
for `R_MIPS_HI16/LO16` relocations.
Differential Revision: http://reviews.llvm.org/D15480
llvm-svn: 255768
|
| |
|
|
|
|
|
|
|
|
| |
The `R_MIPS_JALR` is a relocation generated by gcc and gas. This
relocation points to the `jalr` instruction which might be optimized and
converted to the `b` instruction under some conditions.
Now we just ignore this relocation and keep instructions unchanged.
llvm-svn: 255453
|
| |
|
|
|
|
|
| |
If we have R_MIPS_HI16 relocation, the paired relocation is the next
R_MIPS_LO16 relocation with the same symbol as a target.
llvm-svn: 255452
|
| |
|
|
| |
llvm-svn: 255451
|
| |
|
|
|
|
|
|
|
| |
appropriate bits.
This fixes the remaining clang regression test failures when linking clang with
lld on Darwin.
llvm-svn: 255390
|
| |
|
|
|
|
|
| |
If we don't filter these out we can end up, generating bogus paths, for example:
/home/user/lld/build/bin -> /home/user/home/user/lld/build/bin/lld/build/bin.
llvm-svn: 255378
|
| |
|
|
|
|
|
| |
There is work under way in llvm to avoid creating unnecessary names for
symbols. This makes lld capable of handling that.
llvm-svn: 255357
|
| |
|
|
|
|
| |
This matches the behavior of both gold and bfd ld.
llvm-svn: 255355
|
| |
|
|
|
|
|
|
|
|
|
|
| |
It is reasonable to specify an entry point for shared objects - for
example, for the FreeBSD rtld ld-elf.so.1.
Unlike GNU ld we leave the entry address as 0 if -shared is specified
without -e.
Differential Revision: http://reviews.llvm.org/D15454
llvm-svn: 255349
|
| |
|
|
| |
llvm-svn: 255347
|
| |
|
|
|
|
|
|
|
|
|
|
| |
R_X86_64_SIZE64/R_X86_64_SIZE32 relocations were introduced in 0.98v of "System V Application Binary Interface x86-64" (http://www.x86-64.org/documentation/abi.pdf).
Calculation for them is Z + A, where:
Z - Represents the size of the symbol whose index resides in the relocation entry.
A - Represents the addend used to compute the value of the relocatable field.
Differential revision: http://reviews.llvm.org/D15335
llvm-svn: 255332
|
| |
|
|
|
|
|
|
| |
Fixes PR25798.
Thanks to Ed Maste for the bug report and suggested fix.
llvm-svn: 255307
|
| |
|
|
|
|
|
|
|
|
|
|
| |
When llvm-lit prints a failure, you'll see something like 'lld *command*' However, you can't then take this, paste it in to a terminal and run it, because it's not got the absolute path of lld.
llvm and clang's lit.cfg files contain lists of commands to look for which are substituted by their full paths. So now you'd see something like '*build dir*/bin/lld *command*'.
This patch adds the same capability to lld's lit.cfg
Reviewed by Rafael Espíndola
llvm-svn: 255283
|
| |
|
|
|
|
|
|
|
|
| |
The delta64 relocation is represented as the pair ARM64_RELOC_SUBTRACTOR and ARM64_RELOC_UNSIGNED.
Those should always have the same offset, so this adds a check and tests to ensure this is the case.
Also updated the error printing in this case to shows both relocs when erroring on pair.
llvm-svn: 255274
|
| |
|
|
|
|
|
|
| |
List all sections removed by garbage collection. This option is only effective if garbage collection has been enabled via the `--gc-sections' option.
Differential revision: http://reviews.llvm.org/D15327
llvm-svn: 255235
|
| |
|
|
|
|
|
|
|
| |
If R_386_PLT32 relocation is applied against symbol that can not be preempted then it can be resolved statically.
Patch implements it for x86 target.
Differential revision: http://reviews.llvm.org/D15376
llvm-svn: 255233
|
| |
|
|
|
|
|
|
|
|
|
| |
Implement the TLS relocation optimization for 32-bit x86 that is described in
"ELF Handling For Thread-Local Storage" by Ulrich Drepper, chapter 5,
"IA-32 Linker Optimizations". Specifically, this patch implements these
optimizations: LD->LE, GD->IE, GD->LD, and IE->LE.
Differential revision: http://reviews.llvm.org/D15292
llvm-svn: 255103
|
| |
|
|
|
|
|
|
|
|
|
| |
The gcc_except_tab was generating these references to point to the typeinfo in the data section.
gcc_except_tab also had the DW_EH_PE_indirect flag set which means that at runtime we are going
to dereference this entry as if it is in the GOT.
Reviewed by Nick Kledzik in http://reviews.llvm.org/D15360.
llvm-svn: 255085
|
| |
|
|
|
|
|
|
|
| |
All relocations, which cannot be handled by the dynamic linker,
cause a linking error "rebuild with -fPIC".
Differential revision: http://reviews.llvm.org/D15193
llvm-svn: 254840
|
| |
|
|
|
|
|
|
|
| |
"Ulrich Drepper, ELF Handling For Thread-Local Storage" (5.5 x86-x64 linker optimizations, http://www.akkadia.org/drepper/tls.pdf) shows how GD can be optimized to IE.
This patch implements the optimization.
Differential revision: http://reviews.llvm.org/D15000
llvm-svn: 254713
|
| |
|
|
|
|
|
|
|
| |
Generate R_AARCH64_COPY relocations for non-GOT relocations,
which reference object symbols from shared libraries.
Differential revision: http://reviews.llvm.org/D15043
llvm-svn: 254591
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
If a section symbol is not external, that COMDAT section should never
be merge with other sections in other compilation unit. Previously,
we didn't take visibility into account.
Note that COMDAT sections with non-external visibility makes sense
because they can be removed by dead-stripping.
Fixes https://llvm.org/bugs/show_bug.cgi?id=25686
llvm-svn: 254578
|
| |
|
|
|
|
|
|
|
| |
Main aim of the patch to introduce basic support for TLS access models for x86 target.
Models using @tlsgd, @tlsldm and @gotntpoff are implemented.
Differential revision: http://reviews.llvm.org/D15060
llvm-svn: 254500
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some MIPS relocations including `R_MIPS_HI16/R_MIPS_LO16` use combined
addends. Such addend is calculated using addends of both paired relocations.
Each `R_MIPS_HI16` relocation is paired with the next `R_MIPS_LO16`
relocation. ABI requires to compute such combined addend in case of REL
relocation record format only.
For details see p. 4-17 at
ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf
This patch implements lookup of the next paired relocation suing new
`InputSectionBase::findPairedRelocLocation` method. The primary
disadvantage of this approach is that we put MIPS specific logic into
the common code. The next disadvantage is that we lookup `R_MIPS_LO16`
for each `R_MIPS_HI16` relocation, while in fact multiple `R_MIPS_HI16`
might be paired with the single `R_MIPS_LO16`. From the other side
this way allows us to keep `MipsTargetInfo` class stateless and implement
later relocation handling in parallel.
This patch does not support `R_MIPS_HI16/R_MIPS_LO16` relocations against
`_gp_disp` symbol. In that case the relocations use a special formula for
the calculation. That will be implemented later.
Differential Revision: http://reviews.llvm.org/D15112
llvm-svn: 254461
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
@gottpoff relocations were used at the same time.
Combination of @tlsgd and @gottpoff at the same time leads to miss of R_X86_64_TPOFF64 dynamic relocation. Patch fixes that.
@tlsgd(%rip) - Allocate two contiguous entries in the GOT to hold a tls index
structure (for passing to tls get addr).
@gottpoff(%rip) - Allocate one GOT entry to hold a variable offset in initial TLS
block (relative to TLS block end, %fs:0).
The same situation can be observed for x86 (probably others too, not sure) with corresponding for that target relocations: @tlsgd, @gotntpoff.
Differential revision: http://reviews.llvm.org/D15105
llvm-svn: 254443
|
| |
|
|
|
|
|
|
|
|
| |
ABI specifies the allowed range for these relocations as 2^(n-1) <= X < 2^n.
The patch fixes checks and introduces precise tests for these relocations.
Differential revision: http://reviews.llvm.org/D14957
llvm-svn: 254146
|
| |
|
|
|
|
|
|
| |
It helps to standardize common checks and unify error messages.
Differential revision: http://reviews.llvm.org/D14943
llvm-svn: 254144
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In case a sysroot prefix is configured, and the filename starts with
the '/' character, and the script being processed was located inside
the sysroot prefix, the file's name will be looked for in the sysroot
prefix. Otherwise, the linker falls to the common lookup scheme.
It is slightly modified version of the commit r254031. The problem of
the initial commit was in the `is_absolute` call. On Windows 'C:\' is
absolute path but we do not need to find it under sysroot. In this patch
linker looks up a path under sysroot only if the paths starts with '/'
character.
llvm-svn: 254135
|
| |
|
|
|
|
|
|
|
| |
Fix is (OutputSections.cpp):
for (std::pair<const SymbolBody *, size_t> &I : Entries) {
=>
for (std::pair<const SymbolBody *, unsigned> &I : Entries) {
llvm-svn: 254105
|
| |
|
|
|
|
| |
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/3555
llvm-svn: 254103
|
| |
|
|
|
|
|
|
|
| |
Implements @tlsld (LD to LE) and @tlsgd (GD to LE) optimizations.
Patch does not implement the GD->IE case for @tlsgd.
Differential revision: http://reviews.llvm.org/D14870
llvm-svn: 254101
|
| |
|
|
|
|
|
|
|
|
|
| |
Patch implements lazy relocations for x86.
One of features of x86 is that executable files and shared object files have separate procedure linkage tables. So patch implements both cases.
Detailed information about instructions used can be found in http://docs.oracle.com/cd/E19620-01/805-3050/chapter6-1235/index.html (search: x86: Procedure Linkage Table).
Differential revision: http://reviews.llvm.org/D14955
llvm-svn: 254098
|
| |
|
|
|
|
|
|
|
| |
R_MIPS_CALL16 relocation provides the same result as R_MIPS_GOT16
relocation but does not need to check the result on overflow.
Differential Revision: http://reviews.llvm.org/D14916
llvm-svn: 254092
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch implements next relocations:
R_386_TLS_LE - Negative offset relative to static TLS (GNU version).
R_386_TLS_LE_32 - Offset relative to static TLS block.
These ones are created when using next code sequences:
* @tpoff - The operator must be used to compute an immediate value. The linker will report
an error if the referenced variable is not defined or it is not code for the executable
itself. No GOT entry is created in this case.
* @ntpoff Calculate the negative offset of the variable it is added to relative to the static TLS block.
The operator must be used to compute an immediate value. The linker will report
an error if the referenced variable is not defined or it is not code for the executable
itself. No GOT entry is created in this case.
Information was found in Ulrich Drepper, ELF Handling For Thread-Local Storage, http://www.akkadia.org/drepper/tls.pdf, (6.2, p76)
Differential revision: http://reviews.llvm.org/D14930
llvm-svn: 254090
|
| |
|
|
|
|
|
|
|
| |
Implements R_386_COPY relocation for x86 target.
Similar to one for x64 http://reviews.llvm.org/D14090 which did most of job needed.
Differential revision: http://reviews.llvm.org/D14958
llvm-svn: 254065
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The test fails on Windows:
Command 34: "ld.lld" "-o" "D:\src\llvm\build.release\tools\lld\test\ELF\Output\l
inkerscript.s.tmp2" "D:\src\llvm\build.release\tools\lld\test\ELF\Output\linkers
cript.s.tmp.dir/xyz.script" "--sysroot=D:\src\llvm\build.release\tools\lld\test\
ELF\Output\linkerscript.s.tmp.dir"
Command 34 Result: 1
Command 34 Output:
Command 34 Stderr:
Unable to find /libxyz.a
llvm-svn: 254049
|
| |
|
|
|
|
|
|
|
| |
In the previous patch (r254003), I made the linker emit PT_GNU_STACK
unconditionally. But sometimes you want to have a control over the
presence of the segment. With this patch, you can omit the segment
by passing -z execstack option.
llvm-svn: 254039
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
In case a sysroot prefix is configured, and the filename starts with the
'/' character, and the script being processed was located inside the
sysroot prefix, the file's name will be looked for in the sysroot
prefix. Otherwise, the linker falls to the common lookup scheme.
https://www.sourceware.org/binutils/docs-2.24/ld/File-Commands.html
Differential Revision: http://reviews.llvm.org/D14916
llvm-svn: 254031
|
| |
|
|
|
|
|
| |
This reverts commit r253797 because it was based on a misunderstanding
that lld wouldn't work on NetBSD without this change.
llvm-svn: 254003
|
| |
|
|
| |
llvm-svn: 253971
|
| |
|
|
| |
llvm-svn: 253970
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
the object.
Partial (-z relro) and full (-z relro, -z now) relro cases are implemented.
Partial relro:
The ELF sections are reordered so that the ELF internal data sections (.got, .dtors, etc.) precede the program's data sections (.data and .bss).
.got is readonly, .got.plt is still writeable.
Full relro:
Supports all the features of partial RELRO, .got.plt is also readonly.
Differential revision: http://reviews.llvm.org/D14218
llvm-svn: 253967
|
| |
|
|
|
|
|
|
| |
R_X86_64_GOTTPOFF is not always requires GOT entries. Some relocations can be converted to local ones.
Differential revision: http://reviews.llvm.org/D14713
llvm-svn: 253966
|
| |
|
|
|
|
|
|
|
|
|
| |
R_AARCH64_LD64_GOT_LO12_NC.
With these relocations, it is now possible to build a simple "hello world"
program for AArch64 Debian.
Differential revision: http://reviews.llvm.org/D14917
llvm-svn: 253957
|
| |
|
|
|
|
| |
Thanks to Simon for the bug report.
llvm-svn: 253869
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
With this patch, lld creates PT_GNU_STACK segments only when all input
files have .note.GNU-stack sections. This is in line with other linkers
with a minor difference (we don't care about .note.GNU-stack rwx bits as
you can always remove .note.GNU-stack sections instead of setting x bit.)
At least, NetBSD loader does not understand PT_GNU_STACK segments and
reject any executables that have the section. This patch makes lld
compatible with such operating systems.
llvm-svn: 253797
|
| |
|
|
| |
llvm-svn: 253727
|