summaryrefslogtreecommitdiffstats
path: root/lld
Commit message (Collapse)AuthorAgeFilesLines
...
* [WebAssembly] fix bug in finding .tdata segmentGuanzhong Chen2019-07-182-5/+6
| | | | | | | | | | | | | | | | Summary: Fix bug in `wasm-ld`'s `Writer::createInitTLSFunction` that only finds `.tdata` if it's the first section. Reviewers: tlively, aheejin, sbc100 Reviewed By: sbc100 Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D64947 llvm-svn: 366500
* ELF: Add support for remaining R_AARCH64_MOVW* relocations.Peter Collingbourne2019-07-183-0/+167
| | | | | | Differential Revision: https://reviews.llvm.org/D64685 llvm-svn: 366466
* ELF: Simplify test. NFCI.Peter Collingbourne2019-07-182-10/+6
| | | | | | | | | | Avoid splitting the test into multiple files and use zero for the value of the symbol with addends at relocations so that it's clear what value is being used at relocations. Differential Revision: https://reviews.llvm.org/D64684 llvm-svn: 366463
* ELF: Allow forward references to linked sections.Peter Collingbourne2019-07-182-17/+44
| | | | | | | | | | | It's possible to create IR that uses !associated to refer to a global that appears later in the module, which can result in these types of forward references being generated. Unfortunately our assembler does not currently accept the resulting .s so I needed to use yaml2obj to test this. Differential Revision: https://reviews.llvm.org/D64880 llvm-svn: 366460
* [CMake] Don't set Python_ADDITIONAL_VERSIONSJonas Devlieghere2019-07-181-1/+0
| | | | | | | | | | | | | | | | | | | | | | Until recently, Python_ADDITIONAL_VERSIONS was used to limit LLVM's Python support to 2.7. Now that both LLVM and LLDB both support Python 3, there's no longer a need to put an arbitrary limit on this. However, instead of removing the variable, r365692 expanded the list, which has the (presumably unintentional) side-effect of expression preference for Python 3. Instead, as Michal proposed in the original code review, we should just not set the list at all, and let CMake pick whatever Python interpreter you have in your path. This patch removes the Python_ADDITIONAL_VERSIONS variable in llvm, clang and lld. I've also updated the docs with the default behavior and how to force a different Python version to be used. Differential revision: https://reviews.llvm.org/D64894 llvm-svn: 366447
* [ELF][PPC] Delete ppc64-dynamic-relocations.sFangrui Song2019-07-181-50/+0
| | | | | | I forgot to delete it in r366424. llvm-svn: 366445
* Bump the trunk version to 10.0.0svnHans Wennborg2019-07-182-34/+8
| | | | | | and clear the release notes. llvm-svn: 366427
* [ELF][PPC] Refactor some ppc64 testsFangrui Song2019-07-1810-619/+308
| | | | | | | | Merge ppc64-dynamic-relocations.s into ppc64-plt-stub.s Add ppc64-tls-ie.s: covers ppc64-initial-exec-tls.s and ppc64-tls-ie-le.s Add ppc64-tls-gd.s: covers ppc64-general-dynamic-tls.s, ppc64-gd-to-ie.s, ppc64-tls-gd-le.s, and ppc64-tls-gd-le-small.s llvm-svn: 366424
* [lld] Fix vs-diagnostics-version-script test. NFC.Chris Jackson2019-07-181-5/+2
| | | | | | Removed unnecessary llvm-mc call. llvm-svn: 366418
* Fixup r366333 (require x86 in test)Diana Picus2019-07-181-0/+1
| | | | | | Seems to be required for the other added tests too. llvm-svn: 366416
* [DWARF][RISCV] Add support for RISC-V relocations needed for debug infoAlex Bradbury2019-07-181-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When code relaxation is enabled many RISC-V fixups are not resolved but instead relocations are emitted. This happens even for DWARF debug sections. Therefore, to properly support the parsing of DWARF debug info we need to be able to resolve RISC-V relocations. This patch adds: * Support for RISC-V relocations in RelocationResolver * DWARF support for two relocations per object file offset * DWARF changes to support relocations in more DIE fields The two relocations per offset change is needed because some RISC-V relocations (used for label differences) come in pairs. Relocations can also be emitted for DWARF fields where relocations were not yet evaluated. Adding relocation support for some of these fields is essencial. On the other hand, LLVM currently emits RISC-V relocations for fixups that could be safely evaluated, since they can never be affected by code relaxations. This patch also adds relocation support for the fields affected by those extraneous relocations (the DWARF unit entry Length, and the DWARF debug line entry TotalLength and PrologueLength), for testing purposes. Differential Revision: https://reviews.llvm.org/D62062 Patch by Luís Marques. llvm-svn: 366402
* [ELF][test] Merge/rename some basic*.s testsFangrui Song2019-07-183-239/+40
| | | | | | | | | | basic64be.s is a big-endian powerpc64 test that just duplicates what basic-ppc64.s does. Extend basic-ppc64.s to add big-endian tests. Delete basic64be.s Rename basic32.s to basic-i386.s llvm-svn: 366401
* [lld][WebAssembly] Fix handling of comdat functions in init array.Sam Clegg2019-07-175-18/+25
| | | | | | | | | | | | | | | | | When hidden symbols are discarded by comdat rules we still want to create a local defined symbol, otherwise `Symbol::isDiscarded()` relies on begin able to check `getChunk->discarded`. This is a followup on rL362769. The comdat.ll test was previously GC'ing the `__wasm_call_ctors` functions so `do_init` was not actually being included in the link. Once that function was included in triggered the crash bug that this change addresses. Fixes: https://github.com/emscripten-core/emscripten/issues/8981 Differential Revision: https://reviews.llvm.org/D64872 llvm-svn: 366358
* [lld] Add Visual Studio compatible diagnosticsChris Jackson2019-07-1712-6/+262
| | | | | | | | | | | | Summary: Add a --vs-diagnostics flag that alters the format of diagnostic output to enable source hyperlinks in Visual Studio. Differential Revision: https://reviews.llvm.org/D58484 Reviewed by: ruiu llvm-svn: 366333
* [ELF] Delete redundant pageAlign at PT_GNU_RELRO boundaries after D58892Fangrui Song2019-07-171-19/+0
| | | | | | | | | | | | | | | | | | | | | | | Summary: After D58892 split the RW PT_LOAD on the PT_GNU_RELRO boundary, the new layout is: PT_LOAD(PT_GNU_RELRO(.data.rel.ro .bss.rel.ro)) PT_LOAD(.data. .bss) The two pageAlign() calls at PT_GNU_RELRO boundaries are redundant due to the existence of PT_LOAD. Reviewers: grimar, peter.smith, ruiu, espindola Reviewed By: ruiu Subscribers: sfertile, atanasyan, emaste, arichardson, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D64854 llvm-svn: 366307
* Add REQUIRES: x86 to safeseh-no.s test for x86Reid Kleckner2019-07-161-0/+1
| | | | llvm-svn: 366273
* [WebAssembly] Implement thread-local storage (local-exec model)Guanzhong Chen2019-07-166-10/+221
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Thread local variables are placed inside a `.tdata` segment. Their symbols are offsets from the start of the segment. The address of a thread local variable is computed as `__tls_base` + the offset from the start of the segment. `.tdata` segment is a passive segment and `memory.init` is used once per thread to initialize the thread local storage. `__tls_base` is a wasm global. Since each thread has its own wasm instance, it is effectively thread local. Currently, `__tls_base` must be initialized at thread startup, and so cannot be used with dynamic libraries. `__tls_base` is to be initialized with a new linker-synthesized function, `__wasm_init_tls`, which takes as an argument a block of memory to use as the storage for thread locals. It then initializes the block of memory and sets `__tls_base`. As `__wasm_init_tls` will handle the memory initialization, the memory does not have to be zeroed. To help allocating memory for thread-local storage, a new compiler intrinsic is introduced: `__builtin_wasm_tls_size()`. This instrinsic function returns the size of the thread-local storage for the current function. The expected usage is to run something like the following upon thread startup: __wasm_init_tls(malloc(__builtin_wasm_tls_size())); Reviewers: tlively, aheejin, kripken, sbc100 Subscribers: dschuff, jgravelle-google, hiraditya, sunfish, jfb, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D64537 llvm-svn: 366272
* Mark new test as requiring an x86 backend for LTO native object generationReid Kleckner2019-07-161-0/+2
| | | | llvm-svn: 366245
* Fix linkrepro.test after safeseh:no changeReid Kleckner2019-07-161-0/+6
| | | | | | Add the @feat.00 flag to the input. llvm-svn: 366244
* [COFF] Implement /safeseh:no and check @feat.00 flags by defaultReid Kleckner2019-07-1632-74/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Fixes PR41828. Before this, LLD always emitted SafeSEH chunks and defined __safe_se_handler_table & size. Now, /safeseh:no leaves those undefined. Additionally, we were checking for the safeseh @feat.00 flag in two places: once to emit errors, and once during safeseh table construction. The error was set up to be off by default, but safeseh is supposed to be on by default. I combined the two checks, so now LLD emits an error if an input object lacks @feat.00 and safeseh is enabled. This caused the majority of 32-bit LLD tests to fail, since many test input object files lack @feat.00 symbols. I explicitly added -safeseh:no to those tests to preserve behavior. Finally, LLD no longer sets IMAGE_DLL_CHARACTERISTICS_NO_SEH if any input file wasn't compiled for safeseh. Reviewers: mstorsjo, ruiu, thakis Reviewed By: ruiu, thakis Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63570 llvm-svn: 366238
* [COFF] Rename variale references in comments after VariableName -> ↵Fangrui Song2019-07-1611-24/+24
| | | | | | variableName change llvm-svn: 366193
* [WebAssembly] Rename variale references in comments after VariableName -> ↵Fangrui Song2019-07-165-7/+7
| | | | | | variableName change llvm-svn: 366192
* [NFC][test] Fix for riscv tests.Puyan Lotfi2019-07-164-16/+16
| | | | | | Following tests need updating for: https://reviews.llvm.org/D55277 llvm-svn: 366183
* [ELF] Fix variable names in comments after VariableName -> variableName changeFangrui Song2019-07-1625-106/+104
| | | | | | Also fix some typos. llvm-svn: 366181
* Fix parameter name comments using clang-tidy. NFC.Rui Ueyama2019-07-166-17/+17
| | | | | | | | | | | | | | | | | | | | | This patch applies clang-tidy's bugprone-argument-comment tool to LLVM, clang and lld source trees. Here is how I created this patch: $ git clone https://github.com/llvm/llvm-project.git $ cd llvm-project $ mkdir build $ cd build $ cmake -GNinja -DCMAKE_BUILD_TYPE=Debug \ -DLLVM_ENABLE_PROJECTS='clang;lld;clang-tools-extra' \ -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DLLVM_ENABLE_LLD=On \ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ../llvm $ ninja $ parallel clang-tidy -checks='-*,bugprone-argument-comment' \ -config='{CheckOptions: [{key: StrictMode, value: 1}]}' -fix \ ::: ../llvm/lib/**/*.{cpp,h} ../clang/lib/**/*.{cpp,h} ../lld/**/*.{cpp,h} llvm-svn: 366177
* Re-land "[DebugInfo] Move function from line table to the prologue (NFC)"Jonas Devlieghere2019-07-161-1/+1
| | | | | | | | | | | | | | | | | In LLDB, when parsing type units, we don't need to parse the whole line table. Instead, we only need to parse the "support files" from the line table prologue. To make that possible, this patch moves the respective functions from the LineTable into the Prologue. Because I don't think users of the LineTable should have to know that these files come from the Prologue, I've left the original methods in place, and made them redirect to the LineTable. Differential revision: https://reviews.llvm.org/D64774 llvm-svn: 366164
* [WebAssembly] Rename except_ref type to exnrefHeejin Ahn2019-07-151-2/+2
| | | | | | | | | | | | | | | | | | | Summary: We agreed to rename `except_ref` to `exnref` for consistency with other reference types in https://github.com/WebAssembly/exception-handling/issues/79. This also renames WebAssemblyInstrExceptRef.td to WebAssemblyInstrRef.td in order to use the file for other reference types in future. Reviewers: dschuff Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, jfb, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D64703 llvm-svn: 366145
* Reland "[COFF] Add null check in case of symbols defined in LTO blobs"Reid Kleckner2019-07-154-1/+141
| | | | | | | | | | This reverts r365990 (git commit 1a6053ebc61cb0b8146f5ca27b74859a9a91e0a3) The test no longer depends on the Visual C++ libraries. I confirmed that the crash still reproduces with the new test case if I remove the null check. llvm-svn: 366095
* [LLD][ELF] - Minor simplification. NFC.George Rimar2019-07-151-4/+6
| | | | | | | | | | | | | | | | | This removes a call to `object::getSymbol<ELFT>`. We used this function in a next way: it was given an array of symbols and index and returned either a symbol at the index given or a error. This function was removed in D64631. (rL366052, but was reverted because of LLD compilation error that I didn't know about). It does not make much sense to keep this function on LLVM side only for LLD, because having only a list of symbols and the index it is not able to produce a valueable error message about context anyways. llvm-svn: 366057
* Revert "[COFF] Add null check in case of symbols defined in LTO blobs"Petr Hosek2019-07-134-142/+1
| | | | | | This reverts commit r365979: COFF/undefined-symbol-lto.test is failing. llvm-svn: 365990
* [COFF] Add null check in case of symbols defined in LTO blobsReid Kleckner2019-07-134-1/+142
| | | | | | | | | The test case could probably be improved further if the failure path was better understood. Fixes PR42536 llvm-svn: 365979
* [WebAssembly] i32.const operands should be signedThomas Lively2019-07-122-13/+24
| | | | | | | | | | | | | | | | Summary: This was causing large addresses to be emitted as negative numbers, which rightfully caused crashes in binaryen. Reviewers: aheejin, dschuff Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D64612 llvm-svn: 365930
* Fix odd variable names.Rui Ueyama2019-07-125-7/+7
| | | | llvm-svn: 365875
* [mips] Simplify test case. NFCSimon Atanasyan2019-07-111-13/+5
| | | | | | | | Before rL295040 the linker just crashed when a GOT relocation (R_MIPS_GOT16) comes from a merge section. To ensure that this bug still fixed it's enough to check that the linker does not crash and create GOT entries. llvm-svn: 365834
* [COFF] Share the tail in delayimport symbol thunksMartin Storsjo2019-07-117-82/+177
| | | | | | | | | | | | | E.g. for x86_64, previously each symbol's thunk was 87 bytes. Now there's a 12 byte thunk per symbol, plus a shared 83 byte tail function. This is similar to what both MS link.exe and GNU tools do for delay imports. Differential Revision: https://reviews.llvm.org/D64288 llvm-svn: 365823
* [lld-link] implement -thinlto-{prefix,object-suffix}-replaceBob Haarman2019-07-118-5/+131
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Adds the following two options to lld-link: -thinlto-prefix-replace: allows replacing a prefix in paths generated for ThinLTO. This can be used to ensure index files and native object files are stored in unique directories, allowing multiple distributed ThinLTO links to proceed concurrently. -thinlto-object-suffix-replace: allows replacing a suffix in object file paths involved in ThinLTO. This allows minimized index files to be used for the thin link while storing the paths to the full bitcode files for subsequent steps (code generation and final linking). Reviewers: ruiu, tejohnson, pcc, rnk Subscribers: mehdi_amini, steven_wu, dexonsmith, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D64542 llvm-svn: 365807
* [lld-link] implement -thinlto-index-onlyBob Haarman2019-07-119-7/+205
| | | | | | | | | | | | | | | | | | | | | | | Summary: This implements -thinlto-index-only, -thinlto-index-only:, and -thinlto-emit-imports-files options in lld-link. They are analogous to their counterparts in ld.lld: -thinlto-index-only causes us to perform ThinLTO's thin link and write index files, but not perform code generation. -thinlto-index-only: does the same, but also writes a text file listing the native object files expected to be generated. -thinlto-emit-imports-files creates a text file next to each index file, listing the files to import from. Reviewers: ruiu, tejohnson, pcc, rnk Subscribers: mehdi_amini, steven_wu, dexonsmith, arphaman, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D64461 llvm-svn: 365800
* [WebAssembly] Import __stack_pointer when building -pie binariesSam Clegg2019-07-113-18/+20
| | | | | | | | | | | | | The -pie binary doesn't know that layout ahead of time so needs to import the stack pointer from the embedder, just like we do already for shared libraries. This change is needed in order to address: https://github.com/emscripten-core/emscripten/issues/8915 Differential Revision: https://reviews.llvm.org/D64516 llvm-svn: 365771
* [ELF] Handle non-glob patterns before glob patterns in version scripts & fix ↵Fangrui Song2019-07-114-24/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a corner case of --dynamic-list This fixes PR38549, which is silently accepted by ld.bfd. This seems correct because it makes sense to let non-glob patterns take precedence over glob patterns. lld issues an error because `assignWildcardVersion(ver, VER_NDX_LOCAL);` is processed before `assignExactVersion(ver, v.id, v.name);`. Move all assignWildcardVersion() calls after assignExactVersion() calls to fix this. Also, move handleDynamicList() to the bottom. computeBinding() called by includeInDynsym() has this cryptic rule: if (versionId == VER_NDX_LOCAL && isDefined() && !isPreemptible) return STB_LOCAL; Before the change: * foo's version is set to VER_NDX_LOCAL due to `local: *` * handleDynamicList() is called - foo.computeBinding() is STB_LOCAL - foo.includeInDynsym() is false - foo.isPreemptible is not set (wrong) * foo's version is set to V1 After the change: * foo's version is set to VER_NDX_LOCAL due to `local: *` * foo's version is set to V1 * handleDynamicList() is called - foo.computeBinding() is STB_GLOBAL - foo.includeInDynsym() is true - foo.isPreemptible is set (correct) Reviewed By: ruiu Differential Revision: https://reviews.llvm.org/D64550 llvm-svn: 365760
* [ELF] Warn rather than error when duplicate version assignments occurFangrui Song2019-07-113-10/+46
| | | | | | | | | | | | | | | | | | | | | | In lvm2, libdevmapper.so is linked with a version script with duplicate version assignments: DM_1_02_138 { global: ... dm_bitset_parse_list; ... }; DM_1_02_129 { global: ... dm_bitset_parse_list; ... }; ld.bfd silently accepts this while gold issues a warning. We currently error, thus inhibit producing the executable. Change the error to warning to allow this case, and improve the message. There are some cases where ld.bfd error `anonymous version tag cannot be combined with other version tags` but we just warn. It is probably OK for now. Reviewed By: grimar, ruiu Differential Revision: https://reviews.llvm.org/D64549 llvm-svn: 365759
* Fix build breakage on Win32.Rui Ueyama2019-07-111-1/+1
| | | | llvm-svn: 365737
* Fix build breakage on Darwin.Rui Ueyama2019-07-111-1/+1
| | | | llvm-svn: 365734
* Update comments for r365730. NFC.Rui Ueyama2019-07-112-14/+14
| | | | llvm-svn: 365733
* Fix build breakage on Win32.Rui Ueyama2019-07-111-1/+1
| | | | llvm-svn: 365732
* [Coding style change][lld] Rename variables for non-ELF portsRui Ueyama2019-07-1188-9454/+9454
| | | | | | | | | | | This patch does the same thing as r365595 to other subdirectories, which completes the naming style change for the entire lld directory. With this, the naming style conversion is complete for lld. Differential Revision: https://reviews.llvm.org/D64473 llvm-svn: 365730
* Revert "[ELF] Update test case due to llvm r365618"Nikola Prica2019-07-101-7/+13
| | | | | | | | Reverting du to reverting r365618 This reverts commit b1e76d1d41c2303f70b53e352bdefbff2a2a9d37. llvm-svn: 365686
* ELF: Add support for R_AARCH64_ADR_PREL_PG_HI21_NC relocation.Peter Collingbourne2019-07-103-0/+13
| | | | | | Differential Revision: https://reviews.llvm.org/D64456 llvm-svn: 365662
* [LLD][ELF] - Linkerscript: fix FILL() expressions handling.George Rimar2019-07-103-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | D64130 introduced a bug described in the following message: https://reviews.llvm.org/D64130#1571560 The problem can happen with the following script: SECTIONS { .out : { ... FILL(0x10101010) *(.aaa) ... } The current code tries to read (0x10101010) as an expression and does not break when meets *, what results in a script parsing error. In this patch, I verify that FILL command's expression always wrapped in (). And at the same time =<fillexp> expression can be both wrapped or unwrapped. I checked it matches to bfd/gold. Differential revision: https://reviews.llvm.org/D64476 llvm-svn: 365635
* [ELF] Update test case due to llvm r365618Nikola Prica2019-07-101-13/+7
| | | | llvm-svn: 365619
* Make functions and member variables distinguishable even after the name ↵Rui Ueyama2019-07-1014-72/+69
| | | | | | style change. NFC. llvm-svn: 365605
OpenPOWER on IntegriCloud