summaryrefslogtreecommitdiffstats
path: root/lld/wasm/Config.h
Commit message (Collapse)AuthorAgeFilesLines
* [lld] Fix trivial typos in commentsKazuaki Ishizaki2020-01-061-1/+1
| | | | | | Reviewed By: ruiu, MaskRay Differential Revision: https://reviews.llvm.org/D72196
* [WebAssembly] Initialize memory in start functionThomas Lively2019-09-041-1/+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/+1
| | | | | | | | | | | | | | | 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
* [lld][WebAssembly] Store table base in config rather than passing it around. ↵Sam Clegg2019-08-271-0/+6
| | | | | | | | | | | NFC. I've got another change that makes more use of this value in other places. Differential Revision: https://reviews.llvm.org/D66777 llvm-svn: 370010
* [Coding style change][lld] Rename variables for non-ELF portsRui Ueyama2019-07-111-42/+42
| | | | | | | | | | | 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] Add option to emit passive segmentsThomas Lively2019-07-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | 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
* [WebAssembly] Don't export __data_end and __heap_base by default.Sam Clegg2019-05-311-0/+1
| | | | | | | | These can still be exported via --export if needed. Differential Revision: https://reviews.llvm.org/D62744 llvm-svn: 362276
* [WebAssembly] Add support for -emit-relocsSam Clegg2019-05-241-0/+1
| | | | | | | | | | 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] Handle command line options consistently with the ELF backend.Sam Clegg2019-05-081-0/+8
| | | | | | Differential Revision: https://reviews.llvm.org/D61645 llvm-svn: 360266
* Reland "[WebAssembly] Add linker options to control feature checking"Thomas Lively2019-03-261-0/+2
| | | | | | | | | 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-2/+0
| | | | | | This reverts commit 5991328c96b6146999cfa74ede42901f8c01f2fa. llvm-svn: 356932
* [WebAssembly] Add linker options to control feature checkingThomas Lively2019-03-221-0/+2
| | | | | | | | | | | | | | | | | | | | | 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/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D57725 llvm-svn: 353264
* 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] Initial support for shared objects (-shared)Sam Clegg2018-11-151-0/+5
| | | | | | | | | | | | 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/+1
| | | | | | | | | 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
* [WebAssembly] Add --[no]-export-dynamic to replace --export-defaultSam Clegg2018-09-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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] Update Config member to match command line optionSam Clegg2018-09-271-1/+1
| | | | | | | | Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D50976 llvm-svn: 343157
* [WebAssembly] Add --export-default/--no-export-default optionsSam Clegg2018-09-251-0/+1
| | | | | | | | | | | | | 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] Add --export-all flagSam Clegg2018-06-071-0/+1
| | | | | | | | | | | | | 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-1/+9
| | | | | | 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/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [WebAssembly] Check function signatures by defaultSam Clegg2018-05-051-1/+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/+1
| | | | | | | | | | 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] Name Config members after commandline argument. NFCNicholas Wilson2018-03-281-3/+2
| | | | | | This addresses a late review comment from D44427/rLLD328643 llvm-svn: 328700
* [WebAssembly] Add export/import for function pointer tableNicholas Wilson2018-03-271-0/+3
| | | | | | | | | | 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] Remove unused forward declaration.Rui Ueyama2018-03-011-2/+0
| | | | llvm-svn: 326411
* [WebAssembly] Refactor linker-generated symbols. NFC.Sam Clegg2018-02-021-3/+0
| | | | | | | | | | | | Group all synthetic symbols in the in single struct to match the ELF linker. This change is part of a larger change to add more linker symbols such as `_end` and `_edata`. Differential Revision: https://reviews.llvm.org/D42866 llvm-svn: 324157
* [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
* [WebAssembly] Remove unneeded include. NFC.Sam Clegg2018-01-281-4/+2
| | | | llvm-svn: 323620
* [WebAssembly] Remove --emit-relocsSam Clegg2018-01-221-1/+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] Define __heap_base globalSam Clegg2018-01-171-0/+1
| | | | | | | | | This is an immutable exported global representing the start of the heap area. It is a page aligned. Differential Revision: https://reviews.llvm.org/D42030 llvm-svn: 322609
* [WebAssembly] Create synthetic __wasm_call_ctors functionSam Clegg2018-01-121-0/+1
| | | | | | | | | | | This change create a new synthetic function in the final output binary which calls the static constructors in sequence. See: https://github.com/WebAssembly/tool-conventions/issues/25 Differential Revision: https://reviews.llvm.org/D41893 llvm-svn: 322388
* [WebAssembly] Remove used variableSam Clegg2017-12-071-1/+0
| | | | llvm-svn: 320007
* [WebAssembly] Improve support linker synthetic symbolsSam Clegg2017-12-051-1/+2
| | | | | | | | | | | | | This is part of larger change to add synthetic symbols for section start/end points and init/fini_array: https://reviews.llvm.org/D40760 Allows synthetic global symbols to have an explicitly set virtual address. Differential Revision: https://reviews.llvm.org/D40843 llvm-svn: 319813
* [WebAssembly] Remove used --sysroot optionSam Clegg2017-12-051-1/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D40771 llvm-svn: 319805
* [WebAssembly] Allow function signature checking at link timeSam Clegg2017-11-301-0/+1
| | | | | | | | | | | | | | 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
* Use llvm::StringSet instead of std::set.Rui Ueyama2017-11-291-3/+2
| | | | | | | | | std::set is pretty slow. We generally prefer llvm::StringSet if we don't need an sorted set. Differential Revision: https://reviews.llvm.org/D40579 llvm-svn: 319371
* [WebAssembly] Remove initializers from Config.hSam Clegg2017-11-281-13/+13
| | | | | | | | | | | These should get initialized in by Driver.cpp based on command line options. Also, sort entries. Differential Revision: https://reviews.llvm.org/D40570 llvm-svn: 319219
* [WebAssembly] Initial wasm linker implementationSam Clegg2017-11-171-0/+52
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