summaryrefslogtreecommitdiffstats
path: root/lld/test
Commit message (Collapse)AuthorAgeFilesLines
...
* [WebAssembly] Fix crash when __wasm_call_ctor is GCd in programs containing ↵Sam Clegg2019-03-021-0/+48
| | | | | | | | | | | | static init/fini Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D58864 llvm-svn: 355263
* [WebAssebmly] Allow __wasm_call_ctors to be GC'edSam Clegg2019-03-0127-470/+216
| | | | | | Differential Revision: https://reviews.llvm.org/D58806 llvm-svn: 355240
* ELF: Change FileSize back to a uint64_t.Peter Collingbourne2019-03-013-0/+15
| | | | | | | | | This lets us detect file size overflows when creating a 64-bit binary on a 32-bit machine. Differential Revision: https://reviews.llvm.org/D58840 llvm-svn: 355218
* [lld][test] Fix tests. llvm-readobj now emits symbol section names.Matt Davis2019-03-012-2/+2
| | | | | | | This is the result of patch 99e9c4cad08164b9c0ca565ab9ad48ce132e98e5 See the related patch https://reviews.llvm.org/D58796 llvm-svn: 355211
* [LLD][ELF] - Convert 3 testcases to use yaml instead of binaries.George Rimar2019-03-015-13/+59
| | | | | | | | This change makes 3 tests to use yaml instead of binaries. Differential revision: https://reviews.llvm.org/D58780 llvm-svn: 355196
* [LLD][ELF] - Convert invalid/undefined-local-symbol-in-dso.test to use YAMLGeorge Rimar2019-03-012-56/+17
| | | | | | | | This removes a binary from the inputs and reduces the test case. Differential revision: https://reviews.llvm.org/D58783 llvm-svn: 355194
* ELF: Write .eh_frame_hdr explicitly after writing .eh_frame.Peter Collingbourne2019-02-281-0/+20
| | | | | | | | | | | This lets us remove the special case from Writer::writeSections(), and also fixes a bug where .eh_frame_hdr isn't necessarily written in the correct order if a linker script moves .eh_frame and .eh_frame_hdr into the same output section. Differential Revision: https://reviews.llvm.org/D58795 llvm-svn: 355153
* [COFF] Add address-taken import thunks to the fid tableReid Kleckner2019-02-281-0/+43
| | | | | | | | | | | | | | Summary: Fixes PR39799 Reviewers: dmajor, hans Subscribers: jdoerfert, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D58739 llvm-svn: 355141
* [WebAssembly] Remove uses of ThreadModelThomas Lively2019-02-282-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In the clang UI, replaces -mthread-model posix with -matomics as the source of truth on threading. In the backend, replaces -thread-model=posix with the atomics target feature, which is now collected on the WebAssemblyTargetMachine along with all other used features. These collected features will also be used to emit the target features section in the future. The default configuration for the backend is thread-model=posix and no atomics, which was previously an invalid configuration. This change makes the default valid because the thread model is ignored. A side effect of this change is that objects are never emitted with passive segments. It will instead be up to the linker to decide whether sections should be active or passive based on whether atomics are used in the final link. Reviewers: aheejin, sbc100, dschuff Subscribers: mehdi_amini, jgravelle-google, hiraditya, sunfish, steven_wu, dexonsmith, rupprecht, jfb, jdoerfert, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D58742 llvm-svn: 355112
* [LLD][ELF] - Stop using binary input in invalid/tls-symbol.s test. NFCI.George Rimar2019-02-282-3/+22
| | | | | | We can use yaml2obj instead, patch does this. llvm-svn: 355075
* [LLD][COFF] Support /threads[:no] like the ELF driverAlexandre Ganea2019-02-271-0/+5
| | | | | | Differential review: https://reviews.llvm.org/D58594 llvm-svn: 355029
* [LLD][ELF] - Improve "sh_addralign is not a power of 2" diagnostics.George Rimar2019-02-272-5/+16
| | | | | | | | | | This patch removes the precompiled binary from inputs, replacing it with a YAML. And teaches LLD to report a section name in case of such error. Differential revision: https://reviews.llvm.org/D58670 llvm-svn: 354959
* Output ELF files after ThinLTO is run.Bill Wendling2019-02-262-0/+42
| | | | | | | | | | | | | | | | | | Summary: The gold linker allowed you to output the ELF files after LTO was run. It did it by using the 'obj-path' option. This replicates that behavior. Reviewers: espindola, ruiu, MaskRay, pcc Reviewed By: MaskRay, pcc Subscribers: grimar, emaste, inglorion, arichardson, steven_wu, dexonsmith, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D56046 llvm-svn: 354917
* [mips] Reduce number of tools invocations in the test. NFCSimon Atanasyan2019-02-251-74/+41
| | | | llvm-svn: 354772
* [ELF][ARM] Accept and ignore -p and -no-pipleline-knowledgePeter Smith2019-02-251-0/+2
| | | | | | | | | | | | The linux kernel uses an old flag -p/-no-pipeline-knowledge that is accepted by bfd and gold but ignored by modern versions of them. The original option is very old and is pre-ABI, it sometimes comes up in code-bases that had support for pre ABI toolchains. The Linux kernel uses it in 3 places in the ARM specific section. Differential Revision: https://reviews.llvm.org/D58540 llvm-svn: 354769
* [LLD][COFF] Add support for /FUNCTIONPADMIN command-line optionAlexandre Ganea2019-02-231-0/+147
| | | | | | | | | | Initial patch by Stefan Reinalter. Fixes PR36775 Differential Revision: https://reviews.llvm.org/D49366 llvm-svn: 354716
* [ELF][test]Remove unnecessary empty symbol references in yaml/add missing ↵James Henderson2019-02-228-7/+12
| | | | | | | | | | | | | | | | | | | symbols for relocs yaml2obj used to require the Symbol field in relocations, but it hasn't done so for a couple of years. Another change to yaml2obj will soon land that will look up the symbol by name or index, if present, and emit an error if not found. This will mean that an explicit symbol reference (even to an empty-named symbol) that does not reference a symbol declared in the yaml will result in an error. This patch updates tests that would otherwise start emitting errors. Reviewed by: ruiu, grimar Differential Revision: https://reviews.llvm.org/D58508 llvm-svn: 354666
* [LLD][ELF] - Simplify test case. NFC.George Rimar2019-02-211-7/+0
| | | | | | It has an excessive section declaration. llvm-svn: 354573
* [WebAssembly] Don't generate invalid modules when function signatures mismatchSam Clegg2019-02-204-14/+85
| | | | | | | | | | | | 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-203-11/+48
| | | | | | | | | | | | | | 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
* [lld-link] preserve @llvm.used symbols in LTOBob Haarman2019-02-201-0/+15
| | | | | | | | | | | | | | | | | | | | | | | 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
* [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
* [MinGW] Hook up the --exclude-all-symbols optionMartin Storsjo2019-02-191-0/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D58380 llvm-svn: 354387
* [COFF] Add -exclude-all-symbols for MinGWMartin Storsjo2019-02-191-0/+31
| | | | | | | | | | | | | 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-191-23/+47
| | | | | | | | 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-194-7/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [PPC64] Preserve LocalEntry when linkingRui Ueyama2019-02-151-0/+47
| | | | | | | | | | | | | 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-142-0/+21
| | | | | | Differential Revision: https://reviews.llvm.org/D58026 llvm-svn: 354086
* Improve error message for unknown relocations.Rui Ueyama2019-02-142-3/+3
| | | | | | | | | | | | 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-141-9/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-139-25/+146
| | | | | | | | | | | | | | | | 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-132-0/+40
| | | | | | | | | | | | | 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-131-0/+1
| | | | | | | | | | 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
* lld: unquote possibly quoted `EXTERN("symbol")` entry in linker script.Rui Ueyama2019-02-112-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-091-1/+0
| | | | 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][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-074-7/+7
| | | | | | | | | | 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-071-0/+27
| | | | | | | | | | | | 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
* Fix a bug in R_X86_64_PC{8,16} relocation handling.Rui Ueyama2019-02-072-4/+14
| | | | | | | | 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
* [LLD][ELF] - Set DF_STATIC_TLS flag for X64 targetGeorge Rimar2019-02-074-33/+51
| | | | | | | | | | | | 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-071-1/+22
| | | | | | | | | | | | 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
OpenPOWER on IntegriCloud