summaryrefslogtreecommitdiffstats
path: root/lld/wasm/Options.td
Commit message (Collapse)AuthorAgeFilesLines
* [WebAssembly] Initialize memory in start functionThomas Lively2019-09-041-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: - `__wasm_init_memory` is now the WebAssembly start function instead of being called from `__wasm_call_ctors` or called directly by the runtime. - Adds a new synthetic data symbol `__wasm_init_memory_flag` that is atomically incremented from zero to one by the thread responsible for initializing memory. - All threads now unconditionally perform data.drop on all passive segments. - Removes --passive-segments and --active-segments flags and controls segment type based on --shared-memory instead. The deleted flags were only present to ameliorate the upgrade path in Emscripten. Reviewers: sbc100, aheejin Subscribers: dschuff, jgravelle-google, sunfish, jfb, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D65783 llvm-svn: 370965
* [lld][WebAssembly] Support for growable tablesJacob Gravelle2019-08-271-0/+3
| | | | | | | | | | | | | | | Adds --growable-table flag to handle building wasm modules with tables that can grow. Wasm tables that we use to store function pointers. In order to add functions to that table at runtime, we need to either preallocate space, or grow the table. In order to specify a table with no maximum size, we need some flag to handle that case, separately from a potential --max-table-size= flag. Note that the number of elements in the table isn't knowable until link-time, so it's unclear if we will want a --max-table-size= flag in the future. llvm-svn: 370127
* [WebAssembly] Use passive segments by default when memory is sharedThomas Lively2019-07-181-2/+2
| | | | | | | | | | | | | | | | | | Summary: This change makes it so that passing --shared-memory is all a user needs to do to get proper multithreaded code. This default can still be explicitly overridden for any reason using --passive-segments and --active-segments. Reviewers: sbc100, quantum Subscribers: dschuff, jgravelle-google, aheejin, sunfish, jfb, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D64950 llvm-svn: 366504
* [WebAssembly] Add option to emit passive segmentsThomas Lively2019-07-031-0/+6
| | | | | | | | | | | | | | | | | | | | | | | Summary: Adds `--passive-segments` and `--active-segments` flags to control what kind of segments are emitted. For now the default is always to emit active segments so this is not a breaking change, but in the future the default will be changed to passive segments when shared memory is requested and active segments otherwise. When passive segments are emitted, corresponding memory.init and data.drop instructions are emitted in a `__wasm_init_memory` function that is automatically called at the beginning of `__wasm_call_ctors`. Reviewers: sbc100, aheejin, dschuff Subscribers: azakai, dschuff, jgravelle-google, sunfish, jfb, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59343 llvm-svn: 365088
* [WebAssebmly] Add support for --wrapSam Clegg2019-05-241-0/+3
| | | | | | | | | | | 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 support for -emit-relocsSam Clegg2019-05-241-0/+2
| | | | | | | | | | This can be useful for post-link tools and for testing. Sometimes it can be useful to produces a regular executable but with relocations preserved. Differential Revision: https://reviews.llvm.org/D62378 llvm-svn: 361635
* [WebAssembly] Add --reproduce.Rui Ueyama2019-05-211-0/+2
| | | | | | | | | | | | | | | --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
* Reland "[WebAssembly] Add linker options to control feature checking"Thomas Lively2019-03-261-0/+7
| | | | | | | | | Do not pipe binary data between processes in lit tests this time, since it turns out that can break on Windows. This reverts commit 84c8652fc3085155d0f9c355455e5a797c6d9db6. llvm-svn: 356975
* Revert "[WebAssembly] Add linker options to control feature checking"Thomas Lively2019-03-251-7/+0
| | | | | | This reverts commit 5991328c96b6146999cfa74ede42901f8c01f2fa. llvm-svn: 356932
* [WebAssembly] Add linker options to control feature checkingThomas Lively2019-03-221-0/+7
| | | | | | | | | | | | | | | | | | | | | Summary: Adds --check-features and --no-check-features. The default for now is to enable the checking, but this might change in the future. Also adds --features=foo,bar for precisely controlling the features used in the output binary. Depends on D59173. Reviewers: sbc100, aheejin Subscribers: dschuff, jgravelle-google, sunfish, jdoerfert, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59274 llvm-svn: 356805
* [WebAssembly] Implement --trace and --trace-symbolSam Clegg2019-02-061-0/+6
| | | | | | Differential Revision: https://reviews.llvm.org/D57725 llvm-svn: 353264
* [WebAssembly] Initial support for shared objects (-shared)Sam Clegg2018-11-151-1/+7
| | | | | | | | | | | | Based on the initial spec proposal: https://github.com/WebAssembly/tool-conventions/blob/master/DynamicLinking.md The llvm/codegen side of this is still missing but I believe this change is still worth landing as an incremental step Differential Revision: https://reviews.llvm.org/D54249 llvm-svn: 346918
* [WebAssembly] Support creation and import of shared memoriesDerek Schuff2018-11-061-0/+3
| | | | | | | | | Used for WebAssembly threads proposal. Add a flag --shared-memory which sets the IS_SHARED bit in WasmLimits Differential Revision: https://reviews.llvm.org/D54130 llvm-svn: 346248
* [WedAssembly] Add -s and -S alias for --strip-all and --strip-debugSam Clegg2018-10-311-0/+2
| | | | llvm-svn: 345767
* [WebAssembly] Simplify --help messageSam Clegg2018-10-221-9/+7
| | | | | | | | Update wasm to match ELF changes made rL333596. Differential Revision: https://reviews.llvm.org/D53421 llvm-svn: 344887
* [WebAssembly] Add --[no]-export-dynamic to replace --export-defaultSam Clegg2018-09-271-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | In a very recent change I introduced a --no-export-default flag but after conferring with others it seems that this feature already exists in gnu GNU ld and lld in the form the --export-dynamic flag which is off by default. This change replaces export-default with export-dynamic and also changes the default to match the traditional linker behaviour. Now, by default, only the entry point is exported. If other symbols are required by the embedder then --export-dynamic or --export can be used to export all visibility hidden symbols or individual symbols respectively. This change touches a lot of tests that were relying on symbols being exported by default. I imagine it will also effect many users but do think the change is worth it match of the traditional behaviour and flag names. Differential Revision: https://reviews.llvm.org/D52587 llvm-svn: 343265
* [WebAssembly] Add --export-default/--no-export-default optionsSam Clegg2018-09-251-0/+4
| | | | | | | | | | | | | These option control weather or not symbols marked as visibility default are exported in the output binary. By default this is true, but emscripten prefers to control the exported symbol list explicitly at link time and ignore the symbol attributes. Differential Revision: https://reviews.llvm.org/D52003 llvm-svn: 343034
* [WebAssembly] Don't compress LEBs by defaultSam Clegg2018-08-171-0/+3
| | | | | | | | | LEB compression breaks debug info so we don't want to enable it by default, even at high optimization levels. Differential Revision: https://reviews.llvm.org/D50729 llvm-svn: 340073
* [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] Add --export-all flagSam Clegg2018-06-071-0/+3
| | | | | | | | | | | | | 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-301-0/+13
| | | | | | Differential Revision: https://reviews.llvm.org/D47162 llvm-svn: 333570
* [WebAssembly] Add option to remove LEB padding at relocate sitesSam Clegg2018-05-181-0/+2
| | | | | | | | | | | | | | | | | 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
* [WebAssembly] Add a flag to control merging data segmentsSam Clegg2018-05-101-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-101-1/+1
| | | | | | | | | | | | | | | --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] Check function signatures by defaultSam Clegg2018-05-051-4/+0
| | | | | | | | | But only produce a warning (for now) unless --fatal-warnings is passed. Differential Revision: https://reviews.llvm.org/D46484 llvm-svn: 331574
* [WebAssembly] Add --stack-first option which places the shadow stack at ↵Sam Clegg2018-05-031-0/+3
| | | | | | | | | | 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 export/import for function pointer tableNicholas Wilson2018-03-271-0/+6
| | | | | | | | | | 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] 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-131-0/+9
| | | | | | | | | Previously, Config->Demangle was uninitialised (not hooked up to commandline handling) Differential Revision: https://reviews.llvm.org/D44301 llvm-svn: 327390
* [WebAssembly] Add support for --gc-sectionsSam Clegg2018-01-311-0/+12
| | | | | | | | | | | | | | | 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
* [WebAssembly] Sort options in `Options.td`. NFC.Sam Clegg2018-01-281-33/+41
| | | | | | Differential Revision: https://reviews.llvm.org/D42627 llvm-svn: 323624
* [WebAssembly] Remove --emit-relocsSam Clegg2018-01-221-2/+0
| | | | | | | | | | This was added to mimic ELF, but maintaining it has cost and we currently don't have any use for it outside of the test code. Differential Revision: https://reviews.llvm.org/D42324 llvm-svn: 323154
* [WebAssembly] Add --export flag to force a symbol to be exportedSam Clegg2018-01-121-0/+3
| | | | | | | | | | This is useful for emscripten or other tools that want to selectively exports symbols without necessarily changing the source code. Differential Revision: https://reviews.llvm.org/D42003 llvm-svn: 322408
* [WebAssembly] Add --no-entry argumentSam Clegg2017-12-081-0/+3
| | | | | | | | | | | This adds a `--no-entry` argument to wasm LLD used to suppress the default `_start` entry point. Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D40725 llvm-svn: 320167
* [WebAssembly] Add -u/--undefined argument handlingSam Clegg2017-12-071-0/+9
| | | | | | | | | | | | | | Adds a new argument to wasm-lld, `--undefined`, with similar semantics to the ELF linker. It pulls in symbols from files contained within a `.a` archive, forcing them to be included even if the translation unit would not otherwise be pulled in. Patch by Nicholas Wilson Differential Revision: https://reviews.llvm.org/D40724 llvm-svn: 320004
* [WebAssembly] Remove used --sysroot optionSam Clegg2017-12-051-2/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D40771 llvm-svn: 319805
* [WebAssembly] Allow function signature checking at link timeSam Clegg2017-11-301-0/+4
| | | | | | | | | | | | | | This change allows checking of function signatures but does not yes enable it by default. In this mode, linking two objects that were compiled with a different signatures for the same function will produce a link error. New options for enabling and disabling this feature have been added: (--check-signatures/--no-check-signatures). Differential Revision: https://reviews.llvm.org/D40371 llvm-svn: 319396
* [WebAssembly] Initial wasm linker implementationSam Clegg2017-11-171-0/+89
This linker backend is still a work in progress but is enough to link simple programs including linking against library archives. Differential Revision: https://reviews.llvm.org/D34851 llvm-svn: 318539
OpenPOWER on IntegriCloud