summaryrefslogtreecommitdiffstats
path: root/lld/test/ELF/Inputs
Commit message (Collapse)AuthorAgeFilesLines
...
* Move target independent code out of x86_64 only path.Rafael Espindola2016-02-241-1/+0
| | | | | | | The logic for deciding if an undefined symbol should have the value of a got entry is not target specific. llvm-svn: 261760
* Create implicit plt entries for R_X86_64_32S.Rafael Espindola2016-02-241-0/+4
| | | | llvm-svn: 261749
* Handle a weak undefined tls to archive member.Rafael Espindola2016-02-221-0/+3
| | | | | | | | | | | | A weak undefined should not fetch archive members, so we have to keep the Lazy symbol. That means the lazy symbol has to encode information about the original weak undef. Fixes pr25762. llvm-svn: 261591
* Don't create copy relocs in shared libraries.Rafael Espindola2016-02-221-0/+3
| | | | | | This fixes PR26699. llvm-svn: 261576
* Don't create multiple .got.plt entries for the same symbol.Rafael Espindola2016-02-161-0/+3
| | | | | | We were doing it for ifunc symbols. llvm-svn: 260980
* ELF: Implement the correct semantics of .[cd]tors.Rui Ueyama2016-02-113-0/+15
| | | | | | | | | As I noted in the comment, the sorting order of .[cd]tors are different from .{init,fini}_array's. http://reviews.llvm.org/D17120 llvm-svn: 260620
* [ELF][MIPS] Add lazy relocation support for MIPSSimon Atanasyan2016-02-101-3/+8
| | | | | | | | | | | | | | | The patch adds lazy relocation support for MIPS and R_MIPS_26 relocation handing. R_MIPS_26 relocation might require PLT entry creation. In that case it is fully supported by the patch. But if the relocation target is a local symbol we need to use a different expression to calculate the relocation result. This case is not implemented yet because there is no method to get know the kind of relocation target in the `relocateOne` routine. Differential Revision: http://reviews.llvm.org/D16982 llvm-svn: 260424
* Use the plt entry as the address of some symbols.Rafael Espindola2016-02-091-0/+4
| | | | | | | | | | | | | | | This is the function equivalent of a copy relocation. Since functions are expected to change sizes, we cannot use copy relocations. In situations where one would be needed, what is done instead is: * Create a plt entry * Output an undefined symbol whose addr is the plt entry. The dynamic linker makes sure any shared library uses the plt entry as the function address. llvm-svn: 260224
* [ELF][MIPS] Support R_MIPS_COPY relocationSimon Atanasyan2016-02-081-0/+17
| | | | | | | Generate R_MIPS_COPY relocation for 'static' relocations against object symbols defined in a shared libraries. llvm-svn: 260083
* Don't push relocation sections onto InputSection<ELFT>::Discarded.RelocSectionsSean Silva2016-02-041-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: LLVM3.3 (and earlier) would fail to include a relocation section in the group that the section it was relocating is in. Object files affected by this issue have been encountered in the wild when using LLD. This would result in a siutation like: Section { Index: 5 Name: .text._Z3fooIiEvv (6) Type: SHT_PROGBITS (0x1) Flags [ (0x206) SHF_ALLOC (0x2) SHF_EXECINSTR (0x4) SHF_GROUP (0x200) ] Address: 0x0 Offset: 0x48 Size: 5 Link: 0 Info: 0 AddressAlignment: 1 EntrySize: 0 } Section { Index: 6 Name: .rela.text._Z3fooIiEvv (1) Type: SHT_RELA (0x4) Flags [ (0x0) ] Address: 0x0 Offset: 0x3F0 Size: 24 Link: 8 Info: 5 AddressAlignment: 8 EntrySize: 24 } In LLD, during symbol resolution, we discard the section containing the weak symbol, but this amounts to replacing it with InputSection<ELFT>::Discarded. When we later saw the corresponding relocation section, we would then end up pusing onto InputSection<ELFT>::Discarded.RelocSections, which is bogus. Reviewers: ruiu, rafael Subscribers: llvm-commits, Bigcheese Differential Revision: http://reviews.llvm.org/D16898 llvm-svn: 259831
* ELF: Include archive names in error messages.Rui Ueyama2016-02-021-0/+7
| | | | | | | | If object files are drawn from archive files, the error message should be something like "conflict symbols in foo.a(bar.o) and baz.o" instead of "conflict symbols in bar.o and baz.o". This patch implements that. llvm-svn: 259475
* [ELF] - Symbols from object files that override symbols in DSO are added to ↵George Rimar2016-01-251-0/+16
| | | | | | | | | | | .dynsym table. Main executable did not export symbols that exist both in the main executable and in DSOs before this patch. Symbols from object files that override symbols in DSO should be added to .dynsym table. Differential revision: http://reviews.llvm.org/D16405 llvm-svn: 258672
* Prefer symbols from .o over .so.Rafael Espindola2016-01-181-0/+2
| | | | | | This matches the behavior of gold and bfd ld. llvm-svn: 258102
* Reapply r257753 with fix:George Rimar2016-01-151-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Revert r257753: "[ELF] - implemented --eh-frame-hdr command line option."Rui Ueyama2016-01-141-0/+0
| | | | | | This reverts commit r257753 because we cannot link Clang with this patch. llvm-svn: 257797
* [ELF] - implemented --eh-frame-hdr command line option.George Rimar2016-01-141-0/+0
| | | | | | | | | | | | | | --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
* Reapply r257588George Rimar2016-01-131-0/+19
| | | | | | | | | | | | | | Fix: Added missed input file. Initial commit message: [ELF/AArch64] - Implemented R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 and R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC relocations * R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 is calculated as Page(G(GTPREL(S+A))) – Page(P), set an ADRP immediate field to bits [32:12] of X; check –2^32 ≤ X < 2^32; * R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC is calculated as G(GTPREL(S+A)), set an LD offset field to bits [11:3] of X. No overflow check; check that X&7 = 0. Differential revision: http://reviews.llvm.org/D16117 llvm-svn: 257596
* [ELF][MIPS] Do not use 'sed' to modify binary filesSimon Atanasyan2016-01-122-8/+0
| | | | | | | | | | On Windows different versions of 'sed' work in different text/binary mode by default. If default mode is text, sed produces corrupted binary files. Unfortunately there is no standard command line option to select the mode. Some 'sed' support '-b' to switch to binary mode, while other ones support '--text' option and does not have '-b' option at all. llvm-svn: 257471
* [ELF][MIPS] Prevent substitution of _gp_disp symbolSimon Atanasyan2016-01-121-0/+8
| | | | | | | | | | | | | On MIPS O32 ABI, _gp_disp is a magic symbol designates offset between start of function and gp pointer into GOT. To make seal with such symbol we add new method addIgnoredStrong(). It adds ignored symbol with global binding to prevent the symbol substitution. The addIgnored call is not enough here because this call adds a weak symbol which might be substituted by symbol from shared library. Differential Revision: http://reviews.llvm.org/D16084 llvm-svn: 257449
* [ELF/AARCH64] - Implemented R_AARCH64_TSTBR14 relocation.George Rimar2016-01-111-0/+12
| | | | | | | | | R_AARCH64_TSTBR14 is calculated as S+A-P, Set the immediate field of a TBZ/TBNZ instruction to bits [15:2] of X; check -2^15 ≤ X < 2^15 Differential revision: http://reviews.llvm.org/D15824 llvm-svn: 257334
* [ELF/AARCH64] - Implemented R_AARCH64_CONDBR19 relocation.George Rimar2016-01-111-0/+17
| | | | | | | | | | | | R_AARCH64_CONDBR19 is calculated as S+A-P, Set the immediate field of a conditional branch instruction to bits [20:2] of X; check -2^20 ≤ X< 2^20. Afaik there is no document for AARCH64 instruction encoding from official for unknown reason, so I used gold source code and next link as a reference for implementation: http://kitoslab-eng.blogspot.ru/2012/10/armv8-aarch64-instruction-encoding.html. From which is clear that immediate field of a conditional branch instruction is 5 bits off. That is proved by output which is is equal to gold/bfd now. Differential revision: http://reviews.llvm.org/D15809 llvm-svn: 257333
* ELF: Implement --wrap.Rui Ueyama2016-01-071-0/+4
| | | | | | | | | | | | | In this patch, all symbols are resolved normally and then wrap options are applied. Renaming is implemented by mutating `Body` pointers of Symbols. (As a result, Symtab.find(SymbolName)->getName() may return a string that's different from SymbolName, but that is by design. I designed the symbol and the symbol table to allow this kind of operations.) http://reviews.llvm.org/D15896 llvm-svn: 257075
* [ELF] - implemented @indntpoff (x86) relocation and its optimization.George Rimar2015-12-171-0/+15
| | | | | | | | | | @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
* Treat unnamed symbols as locals.Rafael Espindola2015-12-111-0/+0
| | | | | | | There is work under way in llvm to avoid creating unnecessary names for symbols. This makes lld capable of handling that. llvm-svn: 255357
* [ELF] - R_X86_64_SIZE64/R_X86_64_SIZE32 relocations implemented.George Rimar2015-12-111-0/+6
| | | | | | | | | | | | 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
* Fix alignment computation for copy relocs.Rafael Espindola2015-12-101-0/+9
| | | | | | | | Fixes PR25798. Thanks to Ed Maste for the bug report and suggested fix. llvm-svn: 255307
* [ELF] - Implement the TLS relocation optimization for 32-bit x86.George Rimar2015-12-091-0/+20
| | | | | | | | | | | 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
* [ELF] - Implemented @tlsgd optimization (GD->IE case, x64).George Rimar2015-12-041-0/+20
| | | | | | | | | "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
* [ELF/AArch64] Support R_AARCH64_COPY relocation.Igor Kudrin2015-12-031-3/+3
| | | | | | | | | 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
* [ELF/AArch64] Fix overflow checks for R_AARCH64_{ABS,PREL}{16,32} relocations.Igor Kudrin2015-11-263-0/+6
| | | | | | | | | | 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
* Rename test/elf2 to test/ELF.Rafael Espindola2015-11-1733-0/+231
llvm-svn: 253313
OpenPOWER on IntegriCloud