summaryrefslogtreecommitdiffstats
path: root/lld/wasm
Commit message (Collapse)AuthorAgeFilesLines
...
* [WebAssembly] Add --export-all flagSam Clegg2018-06-074-5/+19
| | | | | | | | | | | | | This causes all symbols to be exported in the final wasm binary even if they were not compiled with default visibility. This feature is useful for the emscripten toolchain that has a corresponding EXPORT_ALL feature which allows the JS code to interact with all C function. Differential Revision: https://reviews.llvm.org/D47806 llvm-svn: 334157
* [WebAssembly] Initial support for LTOSam Clegg2018-05-3012-20/+426
| | | | | | Differential Revision: https://reviews.llvm.org/D47162 llvm-svn: 333570
* [WebAssembly] Add support for response file parsingSam Clegg2018-05-301-0/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D47500 llvm-svn: 333499
* Replace last DEBUG occurrence with LLVM_DEBUG in lld.Nicola Zaghen2018-05-231-9/+9
| | | | llvm-svn: 333084
* [WebAssembly] Fix crash when relocation synbol is not liveSam Clegg2018-05-231-1/+2
| | | | | | | | | | | | | | | | When a symbol is GC'd it can still be references by relocations in the debug sections, but such symbols are not assigned virtual addresses. This change adds a new global data symbol which gets GC'd but should still appears in the output debug info, albeit with a 0 address. Fixes 37555 Differential Revision: https://reviews.llvm.org/D47238 llvm-svn: 333047
* [WebAssembly] Remove dead code from LEB compression pass.Sam Clegg2018-05-221-9/+2
| | | | | | | | | | There are only certain relocation types that can exist in the wasm code section and they are all LEB types. Remove the dead code for handling the other (I32) reloc types. Differential Revision: https://reviews.llvm.org/D47226 llvm-svn: 333030
* [WebAssembly] Fix two bugs in LEB compression: properly calculate function ↵Sam Clegg2018-05-221-1/+2
| | | | | | | | | | | | | body offset, and write I32 values. * Gets function size field from right location * Writes I32 values during compression Patch by Yury Delendik Differential Revision: https://reviews.llvm.org/D47204 llvm-svn: 333002
* Fix unused variable warning in non-debug builds.Richard Trieu2018-05-191-1/+1
| | | | llvm-svn: 332789
* [WebAssembly] Add option to remove LEB padding at relocate sitesSam Clegg2018-05-186-4/+153
| | | | | | | | | | | | | | | | | This change adds the ability for lld to remove LEB padding from code section. This effectively shrinks the size of the resulting binary in proportion to the number of code relocations. Since there will be a performance cost this is currently only active for -O1 and above. Some toolchains may instead want to perform this compression as a post linker step (for example running a binary through binaryen will automatically compress these values). I imagine we might want to make this the default in the future. Differential Revision: https://reviews.llvm.org/D46416 llvm-svn: 332783
* Support: Simplify endian stream interface. NFCI.Peter Collingbourne2018-05-181-1/+1
| | | | | | | | | | | | Provide some free functions to reduce verbosity of endian-writing a single value, and replace the endianness template parameter with a field. Part of PR37466. Differential Revision: https://reviews.llvm.org/D47032 llvm-svn: 332757
* [WebAssembly] Fix R_WEBASSEMBLY_FUNCTION_OFFSET_I32 relocation entriesSam Clegg2018-05-152-15/+5
| | | | | | | | | | | | | | | | | Fixes: lld: warning: unexpected existing value for R_WEBASSEMBLY_FUNCTION_OFFSET_I32: existing=839 expected=838 The existing solution is trying to erroneously recover correct offset of the function code from the body (which is not a function segment that includes its size, locals, and code). The D46763 is trying to maintain the offset of the function code allowing properly calculate the new relocation entry. Patch by Yury Delendik Differential Revision: https://reviews.llvm.org/D46765 llvm-svn: 332412
* [lld] Make helpers static. NFC.Benjamin Kramer2018-05-152-1/+3
| | | | llvm-svn: 332408
* [lld] Update uses of DEBUG macro to LLVM_DEBUG.Nicola Zaghen2018-05-157-56/+60
| | | | | | | | | | | The DEBUG() macro is very generic so it might clash with other projects. The renaming was done as follows: - git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g' - git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM Differential Revision: https://reviews.llvm.org/D44977 llvm-svn: 332351
* [WebAssembly] Allow signautre of entry function to be flexibleSam Clegg2018-05-142-11/+17
| | | | | | | | | Since we a no longer using this function for the wasm start section we don't actually care what its signature is. Differential Revision: https://reviews.llvm.org/D46594 llvm-svn: 332308
* [WebAssembly] Update to match llvm changesSam Clegg2018-05-143-25/+10
| | | | | | | | Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D46849 llvm-svn: 332306
* [WebAssembly] Add a flag to control merging data segmentsSam Clegg2018-05-104-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merging data segments produces smaller code sizes because each segment has some boilerplate. Therefore, merging data segments is generally the right approach, especially with wasm where binaries are typically delivered over the network. However, when analyzing wasm binaries, it can be helpful to get a conservative picture of which functions are using which data segments[0]. Perhaps there is a large data segment that you didn't expect to be included in the wasm, introduced by some library you're using, and you'd like to know which library it was. In this scenario, merging data segments only makes the analysis worse. Alternatively, perhaps you will remove some dead functions by-hand[1] that can't be statically proven dead by the compiler or lld, and removing these functions might make some data garbage collect-able, and you'd like to run `--gc-sections` again so that this now-unused data can be collected. If the segments were originally merged, then a single use of the merged data segment will entrench all of the data. [0] https://github.com/rustwasm/twiggy [1] https://github.com/fitzgen/wasm-snip Patch by Nick Fitzgerald! Differential Revision: https://reviews.llvm.org/D46417 llvm-svn: 332013
* lld-link: Add --color-diagnostics(={always,never,auto})?, ↵Nico Weber2018-05-102-8/+7
| | | | | | | | | | | | | | | --no-color-diagnostics flags. This is most useful when using lld-link on a non-Win host (but it might become useful on Windows too if lld also grows a fansi-escape-codes flag). Also make the help for --color-diagnostic mention the valid values in ELF and wasm, and print the flag name with two dashes in diags, since the one-dash form is seen as a list of many one-letter flags in some contexts. https://reviews.llvm.org/D46693 llvm-svn: 332012
* [WebAssembly] Simplify writing of exports section. NFC.Sam Clegg2018-05-101-34/+25
| | | | | | Differential Revision: https://reviews.llvm.org/D43963 llvm-svn: 332011
* Fix -Wunused-variable warning introduced at r331566.Andrea Di Biagio2018-05-051-1/+1
| | | | llvm-svn: 331589
* [WebAssembly] Check function signatures by defaultSam Clegg2018-05-054-14/+6
| | | | | | | | | But only produce a warning (for now) unless --fatal-warnings is passed. Differential Revision: https://reviews.llvm.org/D46484 llvm-svn: 331574
* [WebAssembly] Only perform sanity checking of relocation targets in debug buildsSam Clegg2018-05-052-10/+45
| | | | | | | | | | | Also: - Reduce the error to a warning so that debug and release versions can still link the same inputs. - Add another check to verify the input LEB is padded to 5 bytes Differential Revision: https://reviews.llvm.org/D46479 llvm-svn: 331571
* [WebAssembly] Add support for debug (DWARF) sectionsSam Clegg2018-05-049-19/+186
| | | | | | | | | | | | | | 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-034-19/+43
| | | | | | | | | | start of linear memory Fixes https://bugs.llvm.org/show_bug.cgi?id=37181 Differential Revision: https://reviews.llvm.org/D46141 llvm-svn: 331467
* [ELF] Fix typo. NFCFangrui Song2018-04-271-1/+1
| | | | llvm-svn: 331018
* [LLD][WASM] Handle WASM_SYMBOL_TYPE_SECTION in toString().Roman Lebedev2018-04-261-0/+2
| | | | | | | Fixes build. If this is not the desired solution, please revert. WasmSymbolType was changed in rL330982 / D44184 llvm-svn: 330984
* [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 -print-gc-sections, to better test GC of globalsNicholas Wilson2018-04-204-5/+20
| | | | | | Differential Revision: https://reviews.llvm.org/D44311 llvm-svn: 330456
* [WebAssembly] Implement GC for importsNicholas Wilson2018-04-204-17/+25
| | | | | | Differential Revision: https://reviews.llvm.org/D44313 llvm-svn: 330454
* [WebAssembly] Implement --print-gc-sections for synthetic functionsNicholas Wilson2018-04-204-8/+23
| | | | | | | | | | 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] Fix bug where reloc addends were written as unsignedSam Clegg2018-04-191-1/+1
| | | | | | | | | | | Relocation addends can be negative so should be written as signed LEBs. This bug meant that writing value between 64 and 128 would be incorrectly interpreted as negative by the object file readers. Differential Revision: https://reviews.llvm.org/D45825 llvm-svn: 330374
* [WebAssembly] Match llvm change to custom section sizeSam Clegg2018-04-122-13/+5
| | | | | | | | | | | | | | Summary: The content of custome sections no longer includes the name itself. See: https://reviews.llvm.org/D45579 Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D45580 llvm-svn: 329948
* [WebAssembly] Add support for custom sectionsSam Clegg2018-04-107-1/+112
| | | | | | | | | 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] Remove StackPointerGlobal member variable from the driver.Rui Ueyama2018-04-051-5/+5
| | | | | | | | | Since InputGlobal makes a copy of a given object, we can use a temporary object allocated on the stack here. Differential Revision: https://reviews.llvm.org/D43924 llvm-svn: 329337
* [WebAssembly] Remove another trivial accessor.Rui Ueyama2018-04-052-11/+6
| | | | | | Differential Revision: https://reviews.llvm.org/D43725 llvm-svn: 329336
* [WebAssembly] Error if both --export-table and --import-table are specified.Rui Ueyama2018-03-301-5/+5
| | | | | | Differential Revision: https://reviews.llvm.org/D45001 llvm-svn: 328873
* [WebAssembly] Name Config members after commandline argument. NFCNicholas Wilson2018-03-283-17/+11
| | | | | | This addresses a late review comment from D44427/rLLD328643 llvm-svn: 328700
* [WebAssembly] Add export/import for function pointer tableNicholas Wilson2018-03-276-7/+58
| | | | | | | | | | 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-142-47/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D44150 llvm-svn: 327527
* [WebAssembly] Avoid COMDAT hashmap lookup for each symbol. NFCNicholas Wilson2018-03-147-15/+29
| | | | | | | | | 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] Fix expected contents of relocations with addendsSam Clegg2018-03-142-3/+5
| | | | | | | | | | | This fixes issues found on the wasm waterfall related to relocations with addends. Undefined symbols, even those with addends should always have a provisional value of zero. At least this is what llvm emits (and I believe this is true for ELF too). Differential Revision: https://reviews.llvm.org/D44451 llvm-svn: 327468
* [WebAssembly] Demangle symbol names for use by the browser debuggerNicholas Wilson2018-03-132-3/+9
| | | | | | Differential Revision: https://reviews.llvm.org/D44316 llvm-svn: 327392
* [WebAssembly] Use helper macro from ELF/Options.td to tidy. NFCNicholas Wilson2018-03-131-15/+9
| | | | | | Differential Revision: https://reviews.llvm.org/D44394 llvm-svn: 327391
* [WebAssembly] Add missing --demangle argNicholas Wilson2018-03-132-0/+10
| | | | | | | | | Previously, Config->Demangle was uninitialised (not hooked up to commandline handling) Differential Revision: https://reviews.llvm.org/D44301 llvm-svn: 327390
* [WebAssembly] Refactor to avoid conflating global and fucntion index space. NFCSam Clegg2018-03-127-88/+96
| | | | | | Differential Revision: https://reviews.llvm.org/D44358 llvm-svn: 327326
* [WebAssembly] Verify contents of relocation target before writing itSam Clegg2018-03-123-0/+61
| | | | | | | | | | | | 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
OpenPOWER on IntegriCloud