summaryrefslogtreecommitdiffstats
path: root/lld
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix unused variable warning.Richard Trieu2019-02-211-2/+2
| | | | llvm-svn: 354535
* [WebAssembly] Don't generate invalid modules when function signatures mismatchSam Clegg2019-02-2010-87/+372
| | | | | | | | | | | | Previously we could emit a warning and generate a potentially invalid wasm module (due to call sites and functions having conflicting signatures). Now, rather than create invalid binaries we handle such cases by creating stub functions containing unreachable, effectively turning these into runtime errors rather than validation failures. Differential Revision: https://reviews.llvm.org/D57909 llvm-svn: 354528
* [mips] Put some MIPS-specific sections to separate segmentsSimon Atanasyan2019-02-204-23/+68
| | | | | | | | | | | | | | Three MIPS-specific sections `.reginfo`, `.MIPS.options`, and `.MIPS.abiflags` are used by loader to read their contents and setup environment for running a program. Loader looks up these data in the corresponding segments: `PT_MIPS_REGINFO`, `PT_MIPS_OPTIONS`, and `PT_MIPS_ABIFLAGS` respectively. This patch put these sections to separate segments like we do already for ARM `SHT_ARM_EXIDX` section. Differential Revision: http://reviews.llvm.org/D58381 llvm-svn: 354468
* ELF: Remove field for .gdb_index in InStruct. NFC.Fangrui Song2019-02-202-5/+2
| | | | | | | | | | | | | | | | Summary: This field is unreferenced outside of createSyntheticSections. Reviewers: ruiu, pcc, espindola, grimar Reviewed By: grimar Subscribers: grimar, emaste, arichardson, arphaman, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D58423 llvm-svn: 354449
* ELF: Remove field for .interp in InStruct. NFC.Peter Collingbourne2019-02-202-5/+2
| | | | | | | | This field is unreferenced outside of createSyntheticSections. Differential Revision: https://reviews.llvm.org/D58422 llvm-svn: 354428
* ELF: Fix typo in --build-id option descriptionTom Stellard2019-02-201-1/+1
| | | | | | | | | | | | | | Reviewers: ruiu, espindola Reviewed By: ruiu Subscribers: emaste, arichardson, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D58265 llvm-svn: 354422
* [lld-link] preserve @llvm.used symbols in LTOBob Haarman2019-02-202-0/+17
| | | | | | | | | | | | | | | | | | | | | | | Summary: We translate @llvm.used to COFF by generating /include directives in the .drectve section. However, in LTO links, this happens after directives have already been processed, so the new directives do not take effect. This change marks @llvm.used symbols as GCRoots so that they are preserved as intended. Fixes PR40733. Reviewers: rnk, pcc, ruiu Reviewed By: ruiu Subscribers: mehdi_amini, steven_wu, dexonsmith, dang, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D58255 llvm-svn: 354410
* Sort enum members so that arch-dependent members are at the right place. NFC.Rui Ueyama2019-02-201-2/+2
| | | | llvm-svn: 354405
* [WebAssembly] Update MC for bulk memoryThomas Lively2019-02-1912-36/+36
| | | | | | | | | | | | | | | | | | Summary: Rename MemoryIndex to InitFlags and implement logic for determining data segment layout in ObjectYAML and MC. Also adds a "passive" flag for the .section assembler directive although this cannot be assembled yet because the assembler does not support data sections. Reviewers: sbc100, aardappel, aheejin, dschuff Subscribers: jgravelle-google, hiraditya, sunfish, rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D57938 llvm-svn: 354397
* Move MinGW-specific code out of LinkerDriver::link. NFC.Rui Ueyama2019-02-194-71/+76
| | | | | | | | LinkerDriver::link is getting too long, it's time to simplify it. Differential Revision: https://reviews.llvm.org/D58395 llvm-svn: 354391
* [MinGW] Hook up the --exclude-all-symbols optionMartin Storsjo2019-02-193-0/+7
| | | | | | Differential Revision: https://reviews.llvm.org/D58380 llvm-svn: 354387
* [COFF] Add -exclude-all-symbols for MinGWMartin Storsjo2019-02-193-4/+41
| | | | | | | | | | | | | This is a private undocumented option, intended to be used by the MinGW driver frontend. Also restructure the condition to put if (Config->MinGW) first. This changes the behaviour for the tautological combination of -export-all-symbols without -lldmingw. Differential Revision: https://reviews.llvm.org/D58380 llvm-svn: 354386
* [mips] Fix indentations in the test. NFCSimon Atanasyan2019-02-191-13/+13
| | | | llvm-svn: 354341
* [ELF] - Update test case after yaml2obj format change.George Rimar2019-02-191-1/+1
| | | | | | yaml2obj was changed in r354338("[yaml2obj][obj2yaml] - Support SHT_GNU_versym (.gnu.version) section.") llvm-svn: 354339
* Convert the eh-frame-hdr-abs-fde.s test to use x86 as a target architectureSimon Atanasyan2019-02-191-9/+9
| | | | | | | The test checks common functionality. Let's use `x86` (generic LLD target) as a target architecture. llvm-svn: 354336
* [mips] Remove trailing whitespaces from the test case. NFCSimon Atanasyan2019-02-191-3/+3
| | | | llvm-svn: 354315
* [mips] Create LA25 thunks for MIPS R6 codeSimon Atanasyan2019-02-192-25/+49
| | | | | | | | MIPS R6 code uses the `R_MIPS_PC26_S2` relocation for calls which might cross boundaries of non-PIC-to-PIC code. We need to create a LA25 thunks for that case. llvm-svn: 354312
* [MIPS] Handle cross-mode (regular <-> microMIPS) jumpsSimon Atanasyan2019-02-197-18/+182
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The patch solves two tasks: 1. MIPS ABI allows to mix regular and microMIPS code and perform cross-mode jumps. Linker needs to detect such cases and replace jump/branch instructions by their cross-mode equivalents. 2. Other tools like dunamic linkers need to recognize cases when dynamic table entries, e_entry field of an ELF header etc point to microMIPS symbol. Linker should provide such information. The first task is implemented in the `MIPS<ELFT>::relocateOne()` method. New routine `fixupCrossModeJump` detects ISA mode change, checks and replaces an instruction. The main problem is how to recognize that relocation target is microMIPS symbol. For absolute and section symbols compiler or assembler set the less-significant bit of the symbol's value or sum of the symbol's value and addend. And this bit signals to linker about microMIPS code. For global symbols compiler cannot do the same trick because other tools like, for example, disassembler wants to know an actual position of the symbol. So compiler sets STO_MIPS_MICROMIPS flag in the `st_other` field. In `MIPS<ELFT>::relocateOne()` method we have a symbol's value only and cannot access any symbol's attributes. To pass type of the symbol (regular/microMIPS) to that routine as well as other places where we write a symbol value as-is (.dynamic section, `Elf_Ehdr::e_entry` field etc) we set when necessary a less-significant bit in the `getSymVA` function. Differential revision: https://reviews.llvm.org/D40147 llvm-svn: 354311
* lld-link: Mention comdat selection work in the 9.0.0 wip release notesNico Weber2019-02-181-0/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D58301 llvm-svn: 354241
* [PPC64] Preserve LocalEntry when linkingRui Ueyama2019-02-152-0/+52
| | | | | | | | | | | | | On PowerPC64, it is necessary to keep the LocalEntry bits in st_other, especially when -r is used. Otherwise, when the resulting object is used in a posterior linking, LocalEntry info will be unavailable and functions may be called through the wrong entrypoint. Patch by Leandro Lupori. Differential Revision: https://reviews.llvm.org/D56782 llvm-svn: 354184
* LLD/AMDGPU: Preserve ABI version during linking ELF for AMDGPUKonstantin Zhuravlyov2019-02-145-3/+38
| | | | | | Differential Revision: https://reviews.llvm.org/D58026 llvm-svn: 354086
* Revert "Revert "[lld] Fix elf::unlinkAsync detached thread""Nick Desaulniers2019-02-141-2/+19
| | | | | | This reverts commit 9934f2ff02dba9fdabe6e27a83f9f95388bf4132. llvm-svn: 354081
* Revert "[lld] Fix elf::unlinkAsync detached thread"Nick Desaulniers2019-02-141-19/+2
| | | | | | This reverts commit 2694810153cf992823eb45253d26b8567424438f. llvm-svn: 354080
* [lld] Fix elf::unlinkAsync detached threadVitaly Buka2019-02-141-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: So this patch just make sure that the thread is at least stated before we return from main. If we just detach then the thread may be actually be stated just after the process returned from main and it's calling atexit handers. Then the thread may try to create own function static variable and it will add new at exit handlers confusing libc. GLIBC before 2.27 had race in that case which corrupted atexit handlers list. Support for this use-case for other implementation is also unclear, so we can try just avoid that. PR40162 Reviewers: ruiu, espindola Subscribers: emaste, arichardson, jfb, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D58246 llvm-svn: 354078
* Move a function from .h to .cpp and use a shorter name. NFC.Rui Ueyama2019-02-142-55/+55
| | | | llvm-svn: 354054
* Remove a comparator from header and instead use lambdas for simplicity. NFC.Rui Ueyama2019-02-143-20/+13
| | | | llvm-svn: 354052
* Add a comment. NFC.Rui Ueyama2019-02-141-16/+22
| | | | llvm-svn: 354049
* Improve error message for unknown relocations.Rui Ueyama2019-02-149-16/+23
| | | | | | | | | | | | Previously, we showed the following message for an unknown relocation: foo.o: unrecognized reloc 256 This patch improves it so that the error message includes a symbol name: foo.o: unknown relocation (256) against symbol bar llvm-svn: 354040
* lld/coff: Simplify error message for comdat selection mismatchesNico Weber2019-02-143-107/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Turns out nobody understands what "conflicting comdat type" is supposed to mean, so just emit a regular "duplicate symbol" error and move the comdat selection information into /verbose output. This also fixes a problem where the error output would depend on the order of .obj files passed. Before this patch: - If passed `one_only.obj discard.obj`, lld-link would only err "conflicting comdat type" - If passed `discard.obj one_only.obj`, lld-link would err "conflicting comdat type" and then "duplicate symbol" Now lld-link only errs "duplicate symbol" in both cases. I considered adding a "Detail" parameter to reportDuplicate() that's printed in parens at the end of the "duplicate symbol" diag if present, and then put the comdat selection mismatch details there, but since users don't know what it's supposed to mean decided against it. I also considered special-casing the Detail message for one_only/discard mismatches, which in practice means "function defined as inline in TU 1 but as out-of-line in TU 2", but I wasn't sure how useful it is so I omitted that too. Differential Revision: https://reviews.llvm.org/D58180 llvm-svn: 354006
* ELF: Allow GOT relocs pointing to non-preemptable ifunc to resolve to an ↵Peter Collingbourne2019-02-1316-117/+345
| | | | | | | | | | | | | | | | IRELATIVE where possible. Non-GOT non-PLT relocations to non-preemptible ifuncs result in the creation of a canonical PLT, which now takes the identity of the IFUNC in the symbol table. This (a) ensures address consistency inside and outside the module, and (b) fixes a bug where some of these relocations end up pointing to the resolver. Fixes (at least) PR40474 and PR40501. Differential Revision: https://reviews.llvm.org/D57371 llvm-svn: 353981
* Recover elf32-bigmips and elf32-powerpc support in LLDRui Ueyama2019-02-134-2/+43
| | | | | | | | | | | | | This fixes a 7.0 -> 8.0 regression when parsing OUTPUT_FORMAT("elf32-powerpc"); or elf32-bigmips directive in ldscripts as well as an unknown emulation error when lld is invoked by clang due to missed elf32ppclinux case. Patch by vit9696 Differential Revision: https://reviews.llvm.org/D58005 llvm-svn: 353968
* Show "Unknown -z option" error message even if --version or --help are given.Rui Ueyama2019-02-132-1/+2
| | | | | | | | | | Previously, we validated -z options after we process --version or --help flags. So, if one of these flags is given, we wouldn't show an "unknown -z option" error. This patch fixes that behavior. Differential Revision: https://reviews.llvm.org/D55446 llvm-svn: 353967
* [PPC64] Update tests to reflect change in printing of call operand. [NFC]Sean Fertile2019-02-128-14/+13
| | | | | | | The printing of branch operands for call instructions was changed to properly handle negative offsets. Updating the tests to reflect that. llvm-svn: 353866
* [PPC64] Sort .toc sections accessed with small code model relocs.Sean Fertile2019-02-125-20/+27
| | | | | | | | | | | | | A follow up to the intial patch that unblocked linking against libgcc. For lld we don't need to bother tracking which objects have got based small code model relocations. This is due to the fact that the compilers on powerpc64 use the .toc section to generate indirections to symbols (rather then using got relocations) which keeps the got small. This makes overflowing a small code model got relocation very unlikely. Differential Revision: https://reviews.llvm.org/D57245 llvm-svn: 353849
* lld: unquote possibly quoted `EXTERN("symbol")` entry in linker script.Rui Ueyama2019-02-113-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | gold accepts quoted strings. binutils requires quoted strings for some kinds of symbols, e.g.: it accepts quoted symbols with @ in name: $ echo 'EXTERN("__libc_start_main@@GLIBC_2.2.5")' > a.script $ g++ a.script /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o: In function `_start': (.text+0x20): undefined reference to `main' collect2: error: ld returned 1 exit status but rejects them if unquoted: $ echo 'EXTERN(__libc_start_main@@GLIBC_2.2.5)' > a.script $ g++ a.script a.script: file not recognized: File format not recognized collect2: error: ld returned 1 exit status To maintain compatibility with existing linker scripts support quoted strings in lld as well. Patch by Lucian Adrian Grijincu. Differential Revision: https://reviews.llvm.org/D57987 llvm-svn: 353756
* Convert CRLF. NFC.Rui Ueyama2019-02-114-593/+593
| | | | llvm-svn: 353751
* [LLD][ELF] - Update test case after yaml2obj change. NFCI.George Rimar2019-02-091-1/+4
| | | | | | | .dynamic section format accepted by yaml2obj was changed in r353606 llvm-svn: 353607
* [ELF] Delete a comment that is no longer correct. Fix a typo. NFCFangrui Song2019-02-092-2/+1
| | | | llvm-svn: 353605
* [LLD][ELF] Ensure tests use -o /dev/null instead of attempting to write to ↵David L. Jones2019-02-091-3/+3
| | | | | | | | the bin directory. [NFC] This error was introduced in r353508. llvm-svn: 353602
* [lld-link] better error message when failing to open archive membersBob Haarman2019-02-081-9/+19
| | | | | | | | | | | | | | | | | Summary: The message "could not get the buffer for the member defining symbol" now also contains the name of the archive and the name of the archive member that we tried to open. Reviewers: ruiu Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D57974 llvm-svn: 353572
* [LLD][ELF]Add test for missing thin archive memberJames Henderson2019-02-081-0/+24
| | | | | | | | | | | | The code producing error messages relating to missing thin archive members was missing any testing as far as I could see, so this patch adds a test for it. Reviewed by: ruiu Differential Revision: https://reviews.llvm.org/D57899 llvm-svn: 353508
* [WebAssembly] Refactor handling of weak undefined functions. NFC.Sam Clegg2019-02-079-57/+85
| | | | | | | | | | Also add to the docs. This is refactor in preparation for https://reviews.llvm.org/D57909 Differential Revision: https://reviews.llvm.org/D57920 llvm-svn: 353478
* [WebAssembly] Fix imported function symbol names that differ from their ↵Dan Gohman2019-02-078-24/+86
| | | | | | | | | | | | import names in the .o format Add a flag to allow symbols to have a wasm import name which differs from the linker symbol name, allowing the linker to link code using the import_module attribute. Differential Revision: https://reviews.llvm.org/D57632 llvm-svn: 353473
* [WebAssembly] Improve docs for wasm linkerSam Clegg2019-02-071-6/+29
| | | | | | Differential Revision: https://reviews.llvm.org/D57913 llvm-svn: 353451
* Fix a bug in R_X86_64_PC{8,16} relocation handling.Rui Ueyama2019-02-073-6/+22
| | | | | | | | R_X86_64_PC{8,16} relocations are sign-extended, so when we check for relocation overflow, we had to use checkInt instead of checkUInt. I confirmed that GNU linkers create the same output for the test case. llvm-svn: 353437
* docs: add missingkeyfunction to doctree, fix titleHans Wennborg2019-02-072-2/+3
| | | | llvm-svn: 353399
* [LLD][ELF] - Set DF_STATIC_TLS flag for X64 targetGeorge Rimar2019-02-075-33/+54
| | | | | | | | | | | | This is the same as D57749, but for x64 target. "ELF Handling For Thread-Local Storage" p41 says (https://www.akkadia.org/drepper/tls.pdf): R_X86_64_GOTTPOFF relocation is used for IE TLS models. Hence if linker sees this relocation we should add DF_STATIC_TLS flag. Differential revision: https://reviews.llvm.org/D57821 llvm-svn: 353378
* [WebAssembly] Honor WASM_SYMBOL_EXPORT symbol flagSam Clegg2019-02-072-2/+23
| | | | | | | | | | | | This flag means that symbol should be exported in the final binary. The reason for this change is to allow source level annotations to trigger a given symbol to be exported: https://github.com/emscripten-core/emscripten/issues/7702 Differential Revision: https://reviews.llvm.org/D57869 llvm-svn: 353364
* [WebAssembly] Update test expectations to match llvm-readobj change. NFC.Sam Clegg2019-02-071-1/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D57868 llvm-svn: 353358
* [MinGW] Add --insert-timestamp as complement to the --no-insert-timestamp optionMartin Storsjo2019-02-063-1/+6
| | | | | | Differential Revision: https://reviews.llvm.org/D57808 llvm-svn: 353342
OpenPOWER on IntegriCloud