summaryrefslogtreecommitdiffstats
path: root/lld/ELF
Commit message (Collapse)AuthorAgeFilesLines
...
* [ELF] - Simplify. NFC.George Rimar2018-05-141-1/+1
| | | | llvm-svn: 332242
* [ELF] Do not error for missing version when symbol has local version.Peter Smith2018-05-141-2/+4
| | | | | | | | | | | | | 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
* [PPC64] isRelExpr should return true for the PPC Call Exprs.Sean Fertile2018-05-111-1/+2
| | | | | | | | | Both R_PPC_CALL and R_PPC_CALL_PLT Exprs map to the R_PPC64_REL24 relocation which has the form Sym + addend - P. Differential Revision: https://reviews.llvm.org/D46654 llvm-svn: 332127
* [ELF] - Revert of: r332038, r332054, r332060, r332061, r332062, r332063George Rimar2018-05-111-16/+5
| | | | | | | | | | | This reverts "Mitigate relocation overflow [part 1 of 2]." and the following commits which were trying to fix the bots. At the moment of r332082, bots are still failing and we need to find the reason of test case breakages first of all. http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/17042/steps/test/logs/stdio http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/29845/steps/test/logs/stdio llvm-svn: 332085
* [ELF] --warn-backref: don't report backref to weak symbols.Fangrui Song2018-05-101-58/+57
| | | | | | | | | | | | | | | | | | | | | Summary: Suppose we visit symbols in this order: 1. weak definition of foo in a lazy object 2. reference of foo 3 (optional). definition of foo bfd/gold allows 123 but not 12. Current --warn-backrefs implementation will report both cases as a backward reference. With this change, both 123 (intended) and 12 (unintended) are allowed. The usage of weak definitions usually imply there are also global definitions, so the trade-off is justified. Reviewers: ruiu, espindola Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D46624 llvm-svn: 332061
* Mitigate relocation overflow [part 1 of 2].Han Shen2018-05-101-5/+16
| | | | | | | | | | | | This CL is to mitigate R_X86_64_PC32 relocation overflow problems for huge binaries that has near 4G allocated sections. By examining those binaries, there're 2 issues contributes to the problem: 1). huge ".dynsym" and ".dynstr" stands in the way between .rodata and .text 2). _init_array_start/end are placed at 0 if no ".init_array" presents, this causes .text relocation against them become more prone to overflow. This CL addresses 1st problem (the 2nd will be addressed in another CL.) by assigning a smaller sortrank to .dynsym and .dynstr thus they no longer stand in between. llvm-svn: 332038
* lld-link: Add --color-diagnostics(={always,never,auto})?, ↵Nico Weber2018-05-102-5/+5
| | | | | | | | | | | | | | | --no-color-diagnostics flags. This is most useful when using lld-link on a non-Win host (but it might become useful on Windows too if lld also grows a fansi-escape-codes flag). Also make the help for --color-diagnostic mention the valid values in ELF and wasm, and print the flag name with two dashes in diags, since the one-dash form is seen as a list of many one-letter flags in some contexts. https://reviews.llvm.org/D46693 llvm-svn: 332012
* [ELF] Omit PT_NOTE for SHT_NOTE without SHF_ALLOCEd Maste2018-05-101-1/+1
| | | | | | | | | | | | | | | | | | | A non-alloc note section should not have a PT_NOTE program header. Found while linking ghc (Haskell compiler) with lld on FreeBSD. ghc emits a .debug-ghc-link-info note section (as the name suggests, it contains link information) as a SHT_NOTE section without SHF_ALLOC set. For this case ld.bfd does not emit a PT_NOTE segment for the .debug-ghc-link-info section. lld previously emitted a PT_NOTE with p_vaddr = 0 and FreeBSD's rtld segfaulted when trying to parse a note at address 0. llvm.org/pr37361 Differential Revision: https://reviews.llvm.org/D46623 llvm-svn: 331973
* [ELF] Rework debug line parsing to use llvm::Error and callbacks (LLD-side)James Henderson2018-05-101-1/+8
| | | | | | | | | | | | | | Reviewed by: ruiu, grimar, espindola Differential Revision: https://reviews.llvm.org/D44562 Summary: r331971 changes the debug line parser interface to report LLVM errors in an interface that different executables can use, rather than always being printed directly as warnings to stderr. This change allows LLD to make use of the new interface and call its own warning methods to report problems. llvm-svn: 331972
* [PPC64] Add lazy symbol resolution stubs.Sean Fertile2018-05-092-10/+76
| | | | | | | | | | | | | | | Adds support for .glink resolver stubs from the example implementation in the V2 ABI (Section 4.2.5.3. Procedure Linkage Table). The stubs are written to the PltSection, and the sections are renamed to match the PPC64 ABI: .got.plt --> .plt Type = SHT_NOBITS .plt --> .glink And adds the DT_PPC64_GLINK dynamic tag to the dynamic section when the plt is not empty. Differential Revision: https://reviews.llvm.org/D45642 llvm-svn: 331840
* New option -z keep-text-section-prefix to keep text sections with prefixes ↵Sriraman Tallam2018-05-083-3/+22
| | | | | | | | | | separate. Separate output sections for selected text section prefixes to enable TLB optimizations and for readablilty. Differential Revision: https://reviews.llvm.org/D45841 llvm-svn: 331823
* Add support for LTO plugin option obj-pathRumeet Dhindsa2018-05-083-2/+5
| | | | | | Differential Revision: https://reviews.llvm.org/D46598 llvm-svn: 331817
* Update ThinLTO Indexing logicRumeet Dhindsa2018-05-082-24/+37
| | | | | | | | Instead of writing empty index for file, this patch tracks the state of files in ObjectToIndexFileState. If the files are not indexed , only then we emit the empty files Differential Revision: https://reviews.llvm.org/D46480 llvm-svn: 331803
* Refactor BitcodeCompiler::add(). NFC.Rui Ueyama2018-05-081-8/+7
| | | | | | | This change makes it explicit that the main loop iterates over a parallel array, Syms and ObjSyms. llvm-svn: 331780
* Fix a bug that a copy of a large vector was created. NFC.Rui Ueyama2018-05-081-1/+1
| | | | llvm-svn: 331779
* [ELF][MIPS] Fix calculation of GP relative relocations in case of ↵Simon Atanasyan2018-05-082-14/+25
| | | | | | | | | | | | | | | | | | | relocatable output Some MIPS relocations depend on "gp" value. By default, this value has 0x7ff0 offset from a .got section. But relocatable files produced by a compiler or a linker might redefine this default value and we have to use it for a calculation of the relocation result. When we generate EXE or DSO it's trivial. Generating a relocatable output is more difficult case because the linker does calculate relocations in this case and cannot store individual "gp" values used by each input object file. As a workaround we add the "gp" value to the relocation addend. This fixes https://llvm.org/pr31149 Differential revision: https://reviews.llvm.org/D45972 llvm-svn: 331772
* Add a CIE with length 0 unconditionally.Fangrui Song2018-05-081-4/+4
| | | | | | | | | | | | Summary: This is not technically required, but glibc unwind-dw2-fde.c classify_object_over_fdes expects there is a CIE record length 0 as a terminator. Reviewers: ruiu, espindola Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D46566 llvm-svn: 331708
* Rename a local variable whose scope is very narrow. NFC.Rui Ueyama2018-05-071-3/+3
| | | | llvm-svn: 331703
* Improve error message for --plugin-opt=thinlto-prefix-replace.Rui Ueyama2018-05-071-1/+2
| | | | llvm-svn: 331700
* Rename Config::ThinLTOIndexOnlyObjectFiles -> Config::ThinLTOIndexOnlyArg.Rui Ueyama2018-05-073-6/+6
| | | | llvm-svn: 331699
* Split BitcodeCompiler::init() into two functions. NFC.Rui Ueyama2018-05-072-34/+33
| | | | | | | | | Previously, code to initialize Backend and code to initialize Conf are intermingled in init(), though they don't depend on each other. Differential Revision: https://reviews.llvm.org/D46554 llvm-svn: 331698
* Add support for thinlto option ( thinlto-emit-imports-files) to emit import ↵Rumeet Dhindsa2018-05-073-7/+17
| | | | | | | | files for thinlink. Differential Revision: https://reviews.llvm.org/D46400 llvm-svn: 331696
* Do not call exit() directly from lld.Rui Ueyama2018-05-072-1/+11
| | | | | | | | | | Our promise is that as long as there's no fatal error (i.e. broken file is given to the linker), our main function returns to the caller. So we can't use exit() in the regular code path. Differential Revision: https://reviews.llvm.org/D46442 llvm-svn: 331690
* Refactor ThinLTO-related code in BitcodeCompiler.cpp. NFC.Rui Ueyama2018-05-072-53/+34
| | | | | | | | | | | | Summary: Refactor ThinLTO-related code in BitcodeCompiler.cpp. NFC. Reviewers: rdhindsa, espindola Subscribers: emaste, inglorion, arichardson, llvm-commits, eraman Differential Revision: https://reviews.llvm.org/D46549 llvm-svn: 331689
* Do not pass Config members to simplify function signature. NFC.Rui Ueyama2018-05-071-9/+4
| | | | llvm-svn: 331658
* Parse --thinlto-prefix-replace early so that we don't need to parse it ↵Rui Ueyama2018-05-073-19/+14
| | | | | | later. NFC. llvm-svn: 331657
* Use StringRef instead of `const std::string &`. NFC.Rui Ueyama2018-05-071-3/+3
| | | | llvm-svn: 331656
* Refactor BitcodeCompiler::createLTO. NFC.Rui Ueyama2018-05-072-19/+22
| | | | llvm-svn: 331655
* ELF Thunks: fix build error: missing 'overrides'Roman Lebedev2018-05-061-1/+1
| | | | llvm-svn: 331608
* [PPC64] Emit plt call stubs to the text section rather then the plt section.Sean Fertile2018-05-064-37/+76
| | | | | | | | | | | | | | | | | | On PowerPC calls to functions through the plt must be done through a call stub that is responsible for: 1) Saving the toc pointer to the stack. 2) Loading the target functions address from the plt into both r12 and the count register. 3) Indirectly branching to the target function. Previously we have been emitting these call stubs to the .plt section, however the .plt section should be reserved for the lazy symbol resolution stubs. This patch moves the call stubs to the text section by moving the implementation from writePlt to the thunk framework. Differential Revision: https://reviews.llvm.org/D46204 llvm-svn: 331607
* [ELF][MIPS] Reorganize isMipsPIC routine. NFCSimon Atanasyan2018-05-041-7/+10
| | | | llvm-svn: 331555
* [ELF][MIPS] Add STO_MIPS_MICROMIPS flag to symbols point to microMIPS PLT ↵Simon Atanasyan2018-05-041-2/+5
| | | | | | records llvm-svn: 331554
* [PPC64] Remove support for ELF V1 ABI in LLD - buildbot fixZaara Syeda2018-05-041-4/+11
| | | | | | | | | Fix buildbot error, failure to build with msvc due to error C2446 Use switch instead of ternary operator. Differential Revision: https://reviews.llvm.org/D46316 llvm-svn: 331534
* [PPC64] Remove support for ELF V1 ABI in LLDZaara Syeda2018-05-047-102/+62
| | | | | | | | | | | The current support for V1 ABI in LLD is incomplete. This patch removes V1 ABI support and changes the default behavior to V2 ABI, issuing an error when using the V1 ABI. It also updates the testcases to V2 and removes any V1 specific tests. Differential Revision: https://reviews.llvm.org/D46316 llvm-svn: 331529
* [ELF][AArch64] Add aarch64_elf64_le_vec emulationPeter Smith2018-05-041-1/+2
| | | | | | | | | | Android AOSP has started specifying -m aarch64_elf64_le_vec as supported by gold and BFD. This is a simple change to add the emulation so that LLD doesn't immediately error when used as a linker in an AOSP build. Differential Revision: https://reviews.llvm.org/D46429 llvm-svn: 331521
* [ELF][AArch64] Implement the AArch64 TLSLD_LDST_LO12 family of relocsPeter Smith2018-05-041-0/+10
| | | | | | | | | | | | | | | | | Implement the following relocations for AArch64: R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC These are specified in ELF for the 64-bit Arm Architecture. Fixes pr36727 Differential Revision: https://reviews.llvm.org/D46255 llvm-svn: 331511
* [ELF][MIPS] Check that a section has a valid reference to a file in the ↵Simon Atanasyan2018-05-031-1/+5
| | | | | | isMipsPIC routine llvm-svn: 331470
* [LLD][AArch64] Simplify relocations sharing same encoding [NFC]Peter Smith2018-05-031-6/+3
| | | | | | | | | | | | | | | The code to encode the result in relocateOne for the relocations: R_AARCH64_LD64_GOT_LO12_NC R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC R_AARCH64_TLSDESC_LD64_LO12 is equivalent to that for R_AARCH64_LDST64_ABS_LO12_NC. This is described in the ABI as "Set the LD/ST immediate field bits [11:3] of X. No overflow check; check that X&7 =0. Differential Revision: https://reviews.llvm.org/D46247 llvm-svn: 331452
* [CMake] Fix BUILD_SHARED_LIBS regression due to r331405David Zarzycki2018-05-031-0/+1
| | | | llvm-svn: 331444
* Updated ThinLTO test to not include forward or backward slash for testingRumeet Dhindsa2018-05-031-1/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D46372 llvm-svn: 331419
* Added support for ThinLTO plugin options : thinlto-index-only and ↵Rumeet Dhindsa2018-05-027-26/+134
| | | | | | | | thinlto-prefix-replace Differential Revision: https://reviews.llvm.org/D46034 llvm-svn: 331405
* Fix warning: result of 32-bit shift implicitly converted to 64 bits - NFCZaara Syeda2018-04-301-1/+1
| | | | | | | | Fix warning caused by rL331046. Differential Revision: https://reviews.llvm.org/D45729 llvm-svn: 331181
* Don't create a temporary DenseMap for each input .eh_frame.Rafael Espindola2018-04-272-1/+5
| | | | | | | | | | These maps are small, but we are creating an destroying one for each input .eh_frame. This patch reduces the total memory allocation from 765.54MB to 749.19MB. The peak is still the same: 563.7MB. llvm-svn: 331075
* Split .eh_frame sections in parellel.Rafael Espindola2018-04-275-15/+10
| | | | | | We can now split them in the same spot we split merge sections. llvm-svn: 331064
* Split merge sections early.Rafael Espindola2018-04-276-23/+13
| | | | | | | | | | | | | | | Now that getSectionPiece is fast (uses a hash) it is probably OK to split merge sections early. The reason I want to do this is to split eh_frame sections in the same place. This does mean that we have to decompress early. Given that the only compressed sections are debug info, I don't think we are missing much. It is a small improvement: 0.5% on the geometric mean. llvm-svn: 331058
* [PPC64] Add offset to local entry point when calling functions without pltZaara Syeda2018-04-271-1/+12
| | | | | | | | | | | | | | PPC64 V2 ABI describes two entry points to a function. The global entry point sets up the TOC base pointer. When calling a local function, the call should branch to the local entry point rather than the global entry point. Section 3.4.1 describes using the 3 most significant bits of the st_other field to find out how many instructions there are between the local and global entry point. This patch adds the correct offset required to branch to the local entry point of a function. Differential Revision: https://reviews.llvm.org/D45729 llvm-svn: 331046
* Do not set RequiresNullTerminator. NFC.Rui Ueyama2018-04-271-1/+1
| | | | | | When reading object files, we don't need '\0' at end of each file. llvm-svn: 331045
* [ELF] Fix typo. NFCFangrui Song2018-04-272-2/+2
| | | | llvm-svn: 331018
* [ELF] Clarify help wording for --symbol-ordering-fileShoaib Meenai2018-04-261-1/+1
| | | | | | | | | | | | | The input file for this option should contain a list of symbols, not a list of sections, so explicitly refer to ordering symbols (but keep the reference to laying out sections, since that's how the option must operate). Referring to the file itself as the "symbol ordering file" is consistent with --warn-symbol-ordering and less ambiguous than "symbol file" (albeit slightly redundant). Differential Revision: https://reviews.llvm.org/D46099 llvm-svn: 331000
* Delete unused variable.Rafael Espindola2018-04-261-1/+1
| | | | llvm-svn: 330978
OpenPOWER on IntegriCloud