summaryrefslogtreecommitdiffstats
path: root/lld/wasm/InputFiles.h
Commit message (Collapse)AuthorAgeFilesLines
* [lld][WebAssembly] Add libcall symbols to the link when LTO is being used.Sam Clegg2020-01-101-0/+4
| | | | | | | | | | | | | | | This code is copied almost verbatim from the equivalent change to the ELF linker: - https://reviews.llvm.org/D50017 - https://reviews.llvm.org/D50475 The upshot is that libraries containing libcall (such as compiler-rt and libc) can be compiled with LTO. Fixes PR41384 Differential Revision: https://reviews.llvm.org/D71738
* [lld][WebAssembly] Fix use after free of archive pathSam Clegg2019-09-181-1/+1
| | | | | | | | This was fixed in the ELF backend in https://reviews.llvm.org/D34554. Differential Revision: https://reviews.llvm.org/D67676 llvm-svn: 372266
* [Coding style change][lld] Rename variables for non-ELF portsRui Ueyama2019-07-111-60/+60
| | | | | | | | | | | 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
* [WebAssembly] Handle object parsing more like the ELF backendSam Clegg2019-06-051-8/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D62886 llvm-svn: 362626
* [WebAssembly] Move direct call tracking from member to local. NFC.Sam Clegg2019-05-291-7/+0
| | | | | | | | | | | This data structure is only needed temporarily while symbols are being created. This is a followup on rL361678. Differential Revision: https://reviews.llvm.org/D62548 llvm-svn: 361977
* [WebAssembly] Relax signature checking for undefined functions that are not ↵Sam Clegg2019-05-241-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | called directly When function signatures don't match and the undefined function is not called directly (i.e. only has its address taken) we don't issue a warning or create a runtime thunk for the undefined function. Instead in this case we simply use the defined version of the function. This is possible since checking signatures of dynamic calls happens at runtime so any invalid usage will still result in a runtime error. This is needed to allow C++ programs to link without generating warnings. Its not uncommon in C++ for vtables to be populated by function address whee the signature of the function is not known in the compilation unit. In this case clang declares the method as void(void) and relies on the vtable caller casting the data back to the correct signature. Fixes: https://bugs.llvm.org/show_bug.cgi?id=40412 Differential Revision: https://reviews.llvm.org/D62153 llvm-svn: 361678
* [WebAssebmly] Add support for --wrapSam Clegg2019-05-241-0/+2
| | | | | | | | | | | The code for implementing this features is taken almost verbatim from the ELF backend. Fixes: https://bugs.llvm.org/show_bug.cgi?id=41681 Differential Revision: https://reviews.llvm.org/D62380 llvm-svn: 361639
* [WebAssembly] Add --reproduce.Rui Ueyama2019-05-211-0/+8
| | | | | | | | | | | | | | | --reproduce is a convenient option for debugging. If you invoke lld with `--reproduce=repro.tar`, it creates `repro.tar` with all input files and the command line options given to the linker, so that it is very easy to run lld with the exact same inputs. ELF and Windows lld have this option. This patch add that option to lld/wasm. Differential Revision: https://reviews.llvm.org/D62170 llvm-svn: 361244
* [WebAssembly] LTO: Honor comdat groups when loading bitcode filesSam Clegg2019-05-151-6/+6
| | | | | | | | | But don't apply comdat groups when loading the LTO object files. This is basically the same logic used by the ELF linker. Differential Revision: https://reviews.llvm.org/D61924 llvm-svn: 360782
* [WebAssembly] Ensure ArchiveName is set even in the presence of --whole-archive.Sam Clegg2019-04-091-3/+9
| | | | | | Differential Revision: https://reviews.llvm.org/D60431 llvm-svn: 357966
* [WebAssembly] Apply data relocations at runtime in shared objectsSam Clegg2019-04-041-0/+3
| | | | | | | | | | | | | See: https://github.com/WebAssembly/tool-conventions/blob/master/DynamicLinking.md Data section relocations in wasm shared libraries are applied by the library itself at static constructor time. This change adds a new synthetic function that applies relocations to relevant memory locations on startup. Differential Revision: https://reviews.llvm.org/D59278 llvm-svn: 357715
* [WebAssembly] Target features sectionThomas Lively2019-03-201-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Implements a new target features section in assembly and object files that records what features are used, required, and disallowed in WebAssembly objects. The linker uses this information to ensure that all objects participating in a link are feature-compatible and records the set of used features in the output binary for use by optimizers and other tools later in the toolchain. The "atomics" feature is always required or disallowed to prevent linking code with stripped atomics into multithreaded binaries. Other features are marked used if they are enabled globally or on any function in a module. Future CLs will add linker flags for ignoring feature compatibility checks and for specifying the set of allowed features, implement using the presence of the "atomics" feature to control the type of memory and segments in the linked binary, and add front-end flags for relaxing the linkage policy for atomics. Reviewers: aheejin, sbc100, dschuff Subscribers: jgravelle-google, hiraditya, sunfish, mgrang, jfb, jdoerfert, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59173 llvm-svn: 356610
* [WebAssembly] Improve support for "needed" list in dylink sectionSam Clegg2019-03-131-0/+11
| | | | | | | | | | | This change adds basic support for shared library dependencies via the dylink section. See https://github.com/WebAssembly/tool-conventions/pull/77 Differential Revision: https://reviews.llvm.org/D59237 llvm-svn: 356102
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [WebAssembly] Merge producers sectionThomas Lively2019-01-171-1/+2
| | | | llvm-svn: 351412
* Revert "[WebAssembly] Merge producers section"Thomas Lively2019-01-171-2/+1
| | | | | | | This reverts commit 71eaf61c6c121c8c3bcaf3490557e92cf81599cb. One of the lld tests was breaking, so revert this change until it is fixed. llvm-svn: 351409
* [WebAssembly] Merge producers sectionThomas Lively2019-01-161-1/+2
| | | | | | | | | | Reviewers: sbc100, aheejin, dschuff Subscribers: jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D56807 llvm-svn: 351400
* [WebAssembly] Add support for the event sectionHeejin Ahn2018-12-081-0/+3
| | | | | | | | | | | | | | | | | Summary: This adds support for the 'event section' specified in the exception handling proposal. Wasm exception handling binary model spec: https://github.com/WebAssembly/exception-handling/blob/master/proposals/Exceptions.md#changes-to-the-binary-model Reviewers: sbc100, ruiu Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D54875 llvm-svn: 348703
* [WebAssembly] Remove `using` statements from header files. NFC.Sam Clegg2018-11-271-14/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D54758 llvm-svn: 347621
* [WebAssembly] Delete unused using statements (NFC)Heejin Ahn2018-11-211-3/+0
| | | | | | | | | | Reviewers: sbc100, dschuff Subscribers: mehdi_amini, jgravelle-google, sunfish, steven_wu, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D54683 llvm-svn: 347370
* [WebAssembly] Add support for --whole-archive.Sam Clegg2018-07-231-0/+4
| | | | | | | | Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D49706 llvm-svn: 337777
* [WebAssembly] Fix archive member display in error messagesSam Clegg2018-07-181-1/+1
| | | | | | | | | Add a test for this by causing a symbol collision between archive members. Differential Revision: https://reviews.llvm.org/D49343 llvm-svn: 337426
* [WebAssembly] Initial support for LTOSam Clegg2018-05-301-4/+22
| | | | | | Differential Revision: https://reviews.llvm.org/D47162 llvm-svn: 333570
* [WebAssembly] Add support for debug (DWARF) sectionsSam Clegg2018-05-041-0/+3
| | | | | | | | | | | | | | Specifically add support for custom sections that contain relocations, and for the two new relocation types needed by DWARF sections. See: https://reviews.llvm.org/D44184 Patch by Yury Delendik! Differential Revision: https://reviews.llvm.org/D44184 llvm-svn: 331566
* [WebAssembly] Add support for custom sectionsSam Clegg2018-04-101-0/+2
| | | | | | | | | Copy user-defined custom sections into the output, concatenating sections with the same name. Differential Revision: https://reviews.llvm.org/D45340 llvm-svn: 329717
* [WebAssembly] Avoid COMDAT hashmap lookup for each symbol. NFCNicholas Wilson2018-03-141-0/+1
| | | | | | | | | This reduces the number of lookups to one per COMDAT group, rather than one per symbol in a COMDAT group. Differential Revision: https://reviews.llvm.org/D44344 llvm-svn: 327523
* [WebAssembly] Verify contents of relocation target before writing itSam Clegg2018-03-121-0/+4
| | | | | | | | | | | | Verify that the location where a relocation is about the be applied contains the expected existing value. This is essentially a sanity check to catch bugs in the compiler and the linker. Differential Revision: https://reviews.llvm.org/D44349 llvm-svn: 327325
* [WebAssembly] Run clang-format. NFCNicholas Wilson2018-03-071-1/+1
| | | | llvm-svn: 326896
* [WebAssembly] Simplify initializeSymbols and merge it with ObjFile::parse. NFC.Rui Ueyama2018-02-281-6/+0
| | | | | | | | | | | This patch simplifies initializeSymbols. Since that function is called at the tail context of ObjFile::parse, and the function is called only once from that function, that's effectively just a continuation of ObjFile::parse. So this patch merge it with ObjFile::parse. Differential Revision: https://reviews.llvm.org/D43848 llvm-svn: 326296
* [WebAssembly] Refactor ObjFile::initializeSymbols.Rui Ueyama2018-02-281-4/+1
| | | | | | | | The main purpose of this change is to make initializeSymbols shorter. Differential Revision: https://reviews.llvm.org/D43691 llvm-svn: 326285
* [WebAssembly] Inline accessor functions that are called only once.Rui Ueyama2018-02-281-7/+0
| | | | | | | | | | | | Looks like these accessor functions are a bit overly defensive, and due to the amount of code, that part isn't easy to read. We have code to log translation results in writeTo and writeRelocations, so I don't think we need to log it again in these functions. I think the new function is much easier to understand. Differential Revision: https://reviews.llvm.org/D43713 llvm-svn: 326277
* [WebAssembly] Add explicit symbol tableSam Clegg2018-02-231-20/+14
| | | | | | | | | | | | | | | | | | This change modified lld to in response the llvm change which moved to a more explicit symbol table in the object format. Based on patches by Nicholas Wilson: 1. https://reviews.llvm.org/D41955 2. https://reviews.llvm.org/D42585 The primary difference that we see in the test output is that for relocatable (-r) output we now have symbol table which replaces exports/imports and globals. See: https://github.com/WebAssembly/tool-conventions/issues/38 Differential Revision: https://reviews.llvm.org/D43264 llvm-svn: 325861
* [WebAssembly] Rename GlobalSymbol types. NFC.Sam Clegg2018-02-201-5/+5
| | | | | | | | | | | | | | | Purely a rename in preparation for adding new global symbol type. We want to use GlobalSymbol to represent real wasm globals and DataSymbol for pointers to things in linear memory (what ELF would call STT_OBJECT). This reduces the size the patch to add the explicit symbol table which is coming soon! Differential Revision: https://reviews.llvm.org/D43476 llvm-svn: 325645
* Consistent (non) use of empty lines in include blocksSam Clegg2018-02-201-3/+1
| | | | | | | | | The profailing style in lld seem to be to not include such empty lines. Clang-tidy/clang-format seem to handle this just fine. Differential Revision: https://reviews.llvm.org/D43528 llvm-svn: 325629
* [WebAssembly] Remove unused headerSam Clegg2018-02-201-1/+0
| | | | | | | | | This header used to be needed here for the `OutRelocation` struct but that no longer exists. Differential Revision: https://reviews.llvm.org/D43516 llvm-svn: 325608
* [WebAssembly] Simplify FunctionSymbol::get/set/hasFunctionType. NFC.Sam Clegg2018-02-161-2/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D43416 llvm-svn: 325415
* [WebAssembly] Use a Symbol class heirarchy. NFC.Sam Clegg2018-02-141-6/+8
| | | | | | | | | This brings wasm into line with ELF and COFF in terms of symbol types are represented. Differential Revision: https://reviews.llvm.org/D43112 llvm-svn: 325150
* [WebAssembly] Write minimal types sectionSam Clegg2018-01-311-0/+1
| | | | | | | | | | | | | | | | | | Don't include type signatures that are not referenced by some relocation. We don't include this in the -gc-sections settings since we are always building the type section from scratch, just like we do the table elements. In the future we might want to unify the relocation processing which is currently done once for gc-sections and then again for building the sympathetic type and table sections. Differential Revision: https://reviews.llvm.org/D42747 llvm-svn: 323931
* [WebAssembly] Add support for --gc-sectionsSam Clegg2018-01-311-0/+2
| | | | | | | | | | | | | | | In this initial version we only GC symbols with `hidden` visibility since other symbols we export to the embedder. We could potentially modify this the future and only use symbols explicitly passed via `--export` as GC roots. This version of the code only does GC of data and code. GC for the types section is coming soon. Differential Revision: https://reviews.llvm.org/D42511 llvm-svn: 323842
* [WebAssemly] Associate symbol with InputChunk in which they are defined. NFC.Sam Clegg2018-01-281-2/+1
| | | | | | | | | | | | | | | | Summary: Rather than explicit Function or InputSegment points store a pointer to the base class (InputChunk) and use llvm dynamic casts when we need a subtype. This change is useful for add the upcoming gc-section support wants to deal with all input chunks. Subscribers: aheejin, llvm-commits Differential Revision: https://reviews.llvm.org/D42625 llvm-svn: 323621
* [WebAssembly] Update to match llvm changes to TABLE relocationsSam Clegg2018-01-231-6/+7
| | | | | | | | | | | | | TABLE relocations now store the function that is being refered to indirectly. See rL323165. Also extend the call-indirect.ll a little. Based on a patch by Nicholas Wilson! llvm-svn: 323168
* [WebAssembly] Add COMDAT supportSam Clegg2018-01-121-0/+2
| | | | | | | | | | | | | | | | | | See https://bugs.llvm.org/show_bug.cgi?id=35533, and D40844 Things covered: * Removing duplicate data segments (as determined by COMDATs emitted by the frontend) * Removing duplicate globals and functions in COMDATs * Checking that each time a COMDAT is seen it has the same symbols as at other times (ie it's a stronger check than simply giving all the symbols in the COMDAT weak linkage) Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D40845 llvm-svn: 322415
* [WebAssembly] Move relocation handling InputChunks.cppSam Clegg2018-01-101-3/+6
| | | | | | | | | Teach each input chunk how to write itself and apply its own relocations. Differential Revision: https://reviews.llvm.org/D41891 llvm-svn: 322212
* [WebAssembly] Add InputChunk as common base class for InputSegment and ↵Sam Clegg2018-01-101-1/+1
| | | | | | | | InputFunction. NFC. Differential Revision: https://reviews.llvm.org/D41419 llvm-svn: 322148
* [WebAssembly] Refactor symbol and symbol table to remove WasmSymbol referencesSam Clegg2018-01-101-6/+6
| | | | | | | | | | | | | | | This WasmSymbol types comes directly from the input objects but we want to be able to represent synthetic symbols too. This is more in line with how the ELF linker represents symbols. This change also removes the logic from Symbol::getVirtualAddress for finding the global address and instead has the InputFile provide this. Differential Revision: https://reviews.llvm.org/D41426 llvm-svn: 322145
* [WebAssembly] Output functions individuallySam Clegg2018-01-091-18/+14
| | | | | | | | | | | | | The code section is now written out one function at a time rather than all the functions in a given objects being serialized at once. This change lays the groundwork for supporting --gc-sections. Differential Revision: https://reviews.llvm.org/D41315 llvm-svn: 322138
* [WebAssembly] De-dup indirect function table.Sam Clegg2017-12-111-5/+9
| | | | | | | | | | | | | | | | Create the indirect function table based on symbols rather than just duplicating the input entries. This has the effect of de-duplicating the table. This is a followup to the equivalent change made for globals: https://reviews.llvm.org/D40859 Partially based on a patch by Nicholas Wilson: https://reviews.llvm.org/D40845 Differential Revision: https://reviews.llvm.org/D40989 llvm-svn: 320428
* Prefer `ArrayRef` over `const std::vector&`Sam Clegg2017-12-081-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D40993 llvm-svn: 320125
* [WebAssembly] Fix symbol exports under -r/--relocatableSam Clegg2017-12-071-1/+0
| | | | | | | | | | | | | | | This change cleans up the way wasm exports and globals are generated, particualrly for -r/--relocatable where globals need to be created and exported in order for output relocations which reference them. Remove the need for a per file GlobalIndexOffset and instead set the output index for each symbol directly. This simplifies the code in several places. Differential Revision: https://reviews.llvm.org/D40859 llvm-svn: 320001
* toString function take a const refs where possibleSam Clegg2017-12-051-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D40824 llvm-svn: 319787
OpenPOWER on IntegriCloud