summaryrefslogtreecommitdiffstats
path: root/lld/wasm/Writer.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [WebAssembly] Add support for debug (DWARF) sectionsSam Clegg2018-05-041-11/+59
| | | | | | | | | | | | | | 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 --stack-first option which places the shadow stack at ↵Sam Clegg2018-05-031-19/+38
| | | | | | | | | | start of linear memory Fixes https://bugs.llvm.org/show_bug.cgi?id=37181 Differential Revision: https://reviews.llvm.org/D46141 llvm-svn: 331467
* [WebAssembly] Add version to linking section (to match llvm-side change)Sam Clegg2018-04-261-2/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D46070 llvm-svn: 330971
* Style fix.Rui Ueyama2018-04-241-3/+3
| | | | llvm-svn: 330785
* [WebAssembly] Match llvm-side change to reloc section headerSam Clegg2018-04-241-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D45795 llvm-svn: 330750
* [WebAssembly] Implement GC for importsNicholas Wilson2018-04-201-7/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D44313 llvm-svn: 330454
* [WebAssembly] Implement --print-gc-sections for synthetic functionsNicholas Wilson2018-04-201-3/+7
| | | | | | | | | | Enables cleaning up confusion between which name variables are mangled and which are unmangled, and --print-gc-sections then excersises and tests that. Differential Revision: https://reviews.llvm.org/D44440 llvm-svn: 330449
* [WebAssembly] Add support for custom sectionsSam Clegg2018-04-101-0/+22
| | | | | | | | | 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] Name Config members after commandline argument. NFCNicholas Wilson2018-03-281-4/+4
| | | | | | This addresses a late review comment from D44427/rLLD328643 llvm-svn: 328700
* [WebAssembly] Add export/import for function pointer tableNicholas Wilson2018-03-271-7/+26
| | | | | | | | | | This enables callback-style programming where the JavaScript environment can call back into the Wasm environment using a function pointer received from the module. Differential Revision: https://reviews.llvm.org/D44427 llvm-svn: 328643
* [WebAssembly] Fix -Werror=extra failure due to enum in ternaryNicholas Wilson2018-03-141-1/+2
| | | | llvm-svn: 327579
* [WebAssembly] Use DenseMapInfo traits from LLVM repo. NFCNicholas Wilson2018-03-141-24/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D44150 llvm-svn: 327527
* [WebAssembly] Avoid COMDAT hashmap lookup for each symbol. NFCNicholas Wilson2018-03-141-3/+3
| | | | | | | | | 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] Add missing implementation for --initial/max-memory argsNicholas Wilson2018-03-141-1/+26
| | | | | | | | | Previously, Config->InitialMemory/MaxMemory were hooked up to some commandline args but had no effect at all. Differential Revision: https://reviews.llvm.org/D44393 llvm-svn: 327508
* [WebAssembly] Replace varargs debugPrint with standard log callNicholas Wilson2018-03-141-19/+9
| | | | | | Differential Revision: https://reviews.llvm.org/D44441 llvm-svn: 327507
* [WebAssembly] Demangle symbol names for use by the browser debuggerNicholas Wilson2018-03-131-2/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D44316 llvm-svn: 327392
* [WebAssembly] Refactor to avoid conflating global and fucntion index space. NFCSam Clegg2018-03-121-26/+27
| | | | | | Differential Revision: https://reviews.llvm.org/D44358 llvm-svn: 327326
* [WebAssembly] Add test for imported ctor and fix indexing bug foundNicholas Wilson2018-03-121-3/+2
| | | | | | | | | This bug was found by accident while trying to expand out testcases for imported symbols, and is covered by the additional test case. Differential Revision: https://reviews.llvm.org/D44331 llvm-svn: 327290
* [WebAssembly] Reorder synthetic functions to come firstNicholas Wilson2018-03-121-5/+3
| | | | | | | | | This matches the existing ordering that's been there for globals for a while (__stack_pointer coming first). Differential Revision: https://reviews.llvm.org/D44333 llvm-svn: 327286
* [WebAssembly] Refactor order of creation for SyntheticFunctionNicholas Wilson2018-03-091-19/+18
| | | | | | | | | | Previously we created __wasm_call_ctors with null InputFunction, and added the InputFunction later. Now we create the SyntheticFunction with null body, and set the body later. Differential Revision: https://reviews.llvm.org/D44206 llvm-svn: 327149
* [WebAssembly] Run clang-format. NFCNicholas Wilson2018-03-071-7/+9
| | | | llvm-svn: 326896
* [WebAssembly] Remove duplicated line of code and unreachable check. NFCNicholas Wilson2018-03-071-3/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D44146 llvm-svn: 326888
* [WebAssembly] Use StringSaver to retain ownership of ctor function body. NFCNicholas Wilson2018-03-071-1/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D44149 llvm-svn: 326885
* [WebAssembly] Reorder reloc sections to come after symtabNicholas Wilson2018-03-051-1/+1
| | | | | | | | This matches LLVM change D43940. Differential Revision: https://reviews.llvm.org/D43946 llvm-svn: 326693
* [WebAssembly] Export non-hidden defined data symbols via wasm globalsNicholas Wilson2018-03-021-7/+1
| | | | | | | | This fixes a TODO introduced in rLLD325861. Differential Revision: https://reviews.llvm.org/D43930 llvm-svn: 326581
* [WebAssembly] Pass ownership of body to SyntheticFunction. NFCNicholas Wilson2018-03-021-10/+10
| | | | | | | | | This avoids the Writer unnecessarily having a member to retain ownership of the function body. Differential Revision: https://reviews.llvm.org/D43933 llvm-svn: 326580
* [WebAssembly] Add validation for init function signatureNicholas Wilson2018-03-021-3/+6
| | | | | | Differential Revision: https://reviews.llvm.org/D43947 llvm-svn: 326579
* [WebAssembly] Use uint8_t for single byte values to match the specSam Clegg2018-03-011-3/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D43922 llvm-svn: 326455
* [WebAssembly] Reorder exports to match symbol table orderNicholas Wilson2018-03-011-22/+6
| | | | | | | | This fixes a TODO introduced in rLLD325861. Differential Revision: https://reviews.llvm.org/D43877 llvm-svn: 326424
* [WebAssembly] Use toArrayRef. NFC.Rui Ueyama2018-02-281-6/+6
| | | | | | Differential Revision: https://reviews.llvm.org/D43855 llvm-svn: 326340
* [WebAssembly] Improve WasmSignatureDenseMapInfo.Rui Ueyama2018-02-281-4/+3
| | | | | | | | | | | | | | Let X and Y be types. Previously, functions F(X, Y) and G(Y, X) had the same hash value because their hash values are computed as follows: hash(F) = hash(X) + hash(Y) hash(G) = hash(Y) + hash(X) This patch fixes the issue by using hash_combine. Differential Revision: https://reviews.llvm.org/D43856 llvm-svn: 326336
* [WebAssembly] Remove unnecessary namespace specifiers. NFC.Rui Ueyama2018-02-281-2/+2
| | | | llvm-svn: 326300
* [WebAssembly] Remove ELF-ness.Rui Ueyama2018-02-281-10/+6
| | | | | | | | | These output section names are ELF-specific. We shouldn't have this rule for WebAssembly. Differential Revision: https://reviews.llvm.org/D43712 llvm-svn: 326289
* [WebAssembly] Do not use inheritance to define SubSection.Rui Ueyama2018-02-281-40/+57
| | | | | | | | | | | | | | SubSection inherited from SyntheticSection, and SyntheticSection inherits from OutputSection, so SubSection was an OutputSection. But that's wrong because SubSection is not actually a WebAssembly output section. It shares some functionalities with OutputSection, but overall it's very different. This patch removes that inheritance. Differential Revision: https://reviews.llvm.org/D43719 llvm-svn: 326286
* [WebAssembly] Do not use Subsection as a local variable name.Rui Ueyama2018-02-281-40/+39
| | | | | | | | That variable hides the class of the same name. Differential Revision: https://reviews.llvm.org/D43718 llvm-svn: 326283
* [WebAssembly] Do not remove existing output file.Rui Ueyama2018-02-281-1/+0
| | | | | | | | | | | | | | | | FileOutputBuffer automatically removes an existing file, so we don't need to do that. Actually doing that is discouraged because when the linker fails to create an output for some reason after instantiating FileOutputBufffer, FileOutputBuffer removes a temporary file and don't touch an existing file. That's an desired behavior from the user's point of view. (Internally, FileOutputBuffer writes its contents to a temporary file and then rename it over to an existing file on commit()). Differential Revision: https://reviews.llvm.org/D43728 llvm-svn: 326281
* [WebAssembly] Simplify createLikingSection.Rui Ueyama2018-02-281-7/+17
| | | | | | | | | | | | Summary: [WebAssembly] Simplify createLikingSection. Reviewers: sbc100 Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D43715 llvm-svn: 326279
* [WebAssembly] Use more specific type and simplify code.Rui Ueyama2018-02-281-20/+13
| | | | | | | | | Instead of {Function,Global,Data}Symbol, use Defined{Function,Global,Data} because undefined symbol should never reach this function. Differential Revision: https://reviews.llvm.org/D43710 llvm-svn: 326275
* [WebAssembly] Remove premature optimization.Rui Ueyama2018-02-281-1/+1
| | | | | | | | | | I think calling reserve() for each object file is too many and isn't useful. We can add reserve() later. By default, we shouldn't add reserve() to a lot of places. Differential Revision: https://reviews.llvm.org/D43722 llvm-svn: 326273
* [WebAssembly] Use StringRef instead of `const char *`.Rui Ueyama2018-02-281-10/+10
| | | | | | Differential Revision: https://reviews.llvm.org/D43721 llvm-svn: 326269
* [WebAssembly] Remove DataSize from linking metadataSam Clegg2018-02-271-16/+9
| | | | | | | | | This means we don't need to write the linking metadata section at all for executable (non-relocatable) output. Differential Revision: https://reviews.llvm.org/D42869 llvm-svn: 326268
* [WebAssembly] Remove dead code.Rui Ueyama2018-02-241-4/+0
| | | | llvm-svn: 326017
* [WebAssembly] Add explicit symbol tableSam Clegg2018-02-231-165/+208
| | | | | | | | | | | | | | | | | | 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] Move lambda declaration output of loop. NFC.Sam Clegg2018-02-231-22/+24
| | | | | | Differential Revision: https://reviews.llvm.org/D43534 llvm-svn: 325857
* [WebAssembly] Use make<> rather then make_unique<>. NFC.Sam Clegg2018-02-211-5/+4
| | | | | | | | | lld uses an arena allocator to one of allocations like these can just use make<>. Differential Revision: https://reviews.llvm.org/D43587 llvm-svn: 325706
* [WebAssembly] Rename member DefinedFunctions -> InputFunctions. NFC.Sam Clegg2018-02-211-16/+16
| | | | | | | | | This avoids confusion with the `DefinedFunction` symbol type. Differential Revision: https://reviews.llvm.org/D43588 llvm-svn: 325705
* [WebAssembly] Use stable sort when sorting ctore functionsSam Clegg2018-02-211-4/+4
| | | | | | Patch by Nicholas Wilson! llvm-svn: 325656
* [WebAssembly] Rename GlobalSymbol types. NFC.Sam Clegg2018-02-201-18/+18
| | | | | | | | | | | | | | | 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-2/+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 unneeded classifer methods from Symbol class. NFC.Sam Clegg2018-02-171-2/+2
| | | | | | | | | We already have isa<> for this, and these methods were simply duplicating those redundantly. Differential Revision: https://reviews.llvm.org/D43422 llvm-svn: 325418
OpenPOWER on IntegriCloud