summaryrefslogtreecommitdiffstats
path: root/lld/wasm/Driver.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [WebAssembly] Don't load weak undefined symbols from archive filesSam Clegg2019-01-291-8/+17
| | | | | | | | | | Summary: Fixes PR40494 Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D57370 llvm-svn: 352554
* 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] Add support for the event sectionHeejin Ahn2018-12-081-2/+2
| | | | | | | | | | | | | | | | | 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] Allow undefined symbols when building shared librariesSam Clegg2018-11-291-7/+9
| | | | | | Differential Revision: https://reviews.llvm.org/D55043 llvm-svn: 347909
* [WebAssembly] Remove `using` statements from header files. NFC.Sam Clegg2018-11-271-0/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D54758 llvm-svn: 347621
* [WebAssembly] Import the stack pointer when building shared librariesSam Clegg2018-11-151-53/+68
| | | | | | Differential Revision: https://reviews.llvm.org/D54558 llvm-svn: 346974
* [WebAssembly] Refactor config setting and checking. NFC.Sam Clegg2018-11-151-51/+64
| | | | | | | | This matches the way the ELF backend does it. Differential Revision: https://reviews.llvm.org/D54559 llvm-svn: 346972
* [WebAssembly] Initial support for shared objects (-shared)Sam Clegg2018-11-151-2/+42
| | | | | | | | | | | | 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] Respect `--no-mangle` in more locationsSam Clegg2018-11-091-4/+2
| | | | | | | | | | | | | `--no-demangle` now also applies to the name section. This change was motivated by the rust team that have a slightly different name mangling scheme to the standard C++ itanium one and prefer to do their de-mangling as a post-link setp. Patch by Alex Crichton! Differential Revision: https://reviews.llvm.org/D54279 llvm-svn: 346516
* [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
* Eliminate dependency to formatv(). NFC.Rui Ueyama2018-10-101-3/+3
| | | | llvm-svn: 344177
* Adapt OptTable::PrintHelp change in D51009Fangrui Song2018-10-101-1/+3
| | | | | | | | | | | | | | Summary: Before, OptTable::PrintHelp append "[options] <inputs>" to its parameter `Help`. It is more flexible to change its semantic to `Usage` and let user customize the usage line. Reviewers: rupprecht, ruiu, espindola Reviewed By: rupprecht Subscribers: emaste, sbc100, arichardson, aheejin, llvm-commits Differential Revision: https://reviews.llvm.org/D53054 llvm-svn: 344099
* [WebAssembly] Refactor use of signaturesDerek Schuff2018-10-031-1/+1
| | | | | | | | Update use of WebAssemblySignature to go along with D52580 Differential Revision: https://reviews.llvm.org/D52622 llvm-svn: 343734
* [WebAssembly] Add --[no]-export-dynamic to replace --export-defaultSam Clegg2018-09-271-3/+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] Update Config member to match command line optionSam Clegg2018-09-271-3/+3
| | | | | | | | 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/+2
| | | | | | | | | | | | | 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] clang-format (NFC)Heejin Ahn2018-08-291-4/+3
| | | | | | | | | | | | Summary: This patch runs clang-format on all wasm-only files. Reviewers: sbc100 Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D51449 llvm-svn: 340970
* Rename a function to follow the LLVM coding style.Rui Ueyama2018-08-271-1/+1
| | | | llvm-svn: 340716
* win: Omit ".exe" from lld warning and error messages.Nico Weber2018-08-221-1/+1
| | | | | | | | | | | This is a minor follow-up to https://reviews.llvm.org/D49189. On Windows, lld used to print "lld-link.exe: error: ...". Now it just prints "lld-link: error: ...". This matches what link.exe does (it prints "LINK : ...") and makes lld's output less dependent on the host system. https://reviews.llvm.org/D51133 llvm-svn: 340487
* [WebAssembly] Don't compress LEBs by defaultSam Clegg2018-08-171-1/+6
| | | | | | | | | 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] --export should fetch lazy symbolsSam Clegg2018-08-061-10/+11
| | | | | | | | | | | --export now implies --undefined This is really a requirement from emscripten but I think it makes sense in general too. Differential Revision: https://reviews.llvm.org/D50287 llvm-svn: 339047
* [WebAssembly] Don't error when --undefined symbols are not foundSam Clegg2018-08-041-36/+30
| | | | | | | | | | | | | | | This matches the behavior of the ELF linker where -u/--undefined means symbols will get pulled in from archives but won't result in link error if they are missing. Also, don't actually great symbol table entries for the undefined symbols, again matching more closely the ELF linker. This also results in simplification of the code. Differential Revision: https://reviews.llvm.org/D50279 llvm-svn: 338938
* [WebAssembly] Add support for --whole-archive.Sam Clegg2018-07-231-2/+51
| | | | | | | | Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D49706 llvm-svn: 337777
* Omit path to lld binary from lld's error, warning, and log output.Nico Weber2018-07-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lld currently prepends the absolute path to itself to every diagnostic it emits. This path can be longer than the diagnostic, and makes the actual error message hard to read. There isn't a good reason for printing this path: if you want to know which lld you're running, pass -v to clang – chances are that if you're unsure of this, you're not only unsure when it errors out. Some people want an indication that the diagnostic is from the linker though, so instead print just the basename of the linker's path. Before: ``` $ out/bin/clang -target x86_64-unknown-linux -x c++ /dev/null -fuse-ld=lld /Users/thakis/src/llvm-mono/out/bin/ld.lld: error: cannot open crt1.o: No such file or directory /Users/thakis/src/llvm-mono/out/bin/ld.lld: error: cannot open crti.o: No such file or directory /Users/thakis/src/llvm-mono/out/bin/ld.lld: error: cannot open crtbegin.o: No such file or directory /Users/thakis/src/llvm-mono/out/bin/ld.lld: error: unable to find library -lgcc /Users/thakis/src/llvm-mono/out/bin/ld.lld: error: unable to find library -lgcc_s /Users/thakis/src/llvm-mono/out/bin/ld.lld: error: unable to find library -lc /Users/thakis/src/llvm-mono/out/bin/ld.lld: error: unable to find library -lgcc /Users/thakis/src/llvm-mono/out/bin/ld.lld: error: unable to find library -lgcc_s /Users/thakis/src/llvm-mono/out/bin/ld.lld: error: cannot open crtend.o: No such file or directory /Users/thakis/src/llvm-mono/out/bin/ld.lld: error: cannot open crtn.o: No such file or directory clang: error: linker command failed with exit code 1 (use -v to see invocation) ``` After: ``` $ out/bin/clang -target x86_64-unknown-linux -x c++ /dev/null -fuse-ld=lld ld.lld: error: cannot open crt1.o: No such file or directory ld.lld: error: cannot open crti.o: No such file or directory ld.lld: error: cannot open crtbegin.o: No such file or directory ld.lld: error: unable to find library -lgcc ld.lld: error: unable to find library -lgcc_s ld.lld: error: unable to find library -lc ld.lld: error: unable to find library -lgcc ld.lld: error: unable to find library -lgcc_s ld.lld: error: cannot open crtend.o: No such file or directory ld.lld: error: cannot open crtn.o: No such file or directory clang: error: linker command failed with exit code 1 (use -v to see invocation) ``` https://reviews.llvm.org/D49189 llvm-svn: 337634
* [WebAssembly] Fix --export of LTO symbolsSam Clegg2018-06-281-10/+10
| | | | | | Differential Revision: https://reviews.llvm.org/D48697 llvm-svn: 335881
* [WebAssembly] LTO: Fix signatures of undefined functions in bitcodeSam Clegg2018-06-281-2/+2
| | | | | | | | | | | Function symbols that come from bitcode have not signatures. After LTO when the real symbols are read in we need to make sure that we set the signature on the existing symbol. the signature-less undefined functions. Differential Revision: https://reviews.llvm.org/D48693 llvm-svn: 335875
* Revert "[WebAssembly] Error on mismatched function signature in final output"Sam Clegg2018-06-221-2/+1
| | | | | | | | | | This caused a lot of issues on the WebAssembly waterfall. In particular, until with the signature of `main`. We probably want a better solution for main before we re-land. Reverts rL335192 llvm-svn: 335355
* [WebAssembly] Error on mismatched function signature in final outputSam Clegg2018-06-211-1/+2
| | | | | | | | | | | | | During symbol resolution, emit warnings for function signature mismatches. During GC, if any mismatched symbol is marked as live then generate an error. This means that we only error out if the mismatch is written to the final output. i.e. if we would generate an invalid wasm file. Differential Revision: https://reviews.llvm.org/D48394 llvm-svn: 335192
* [WebAssembly] Add --export-all flagSam Clegg2018-06-071-4/+4
| | | | | | | | | | | | | 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-6/+58
| | | | | | 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
* [WebAssembly] Add option to remove LEB padding at relocate sitesSam Clegg2018-05-181-0/+3
| | | | | | | | | | | | | | | | | 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
* [lld] Make helpers static. NFC.Benjamin Kramer2018-05-151-0/+2
| | | | llvm-svn: 332408
* [WebAssembly] Allow signautre of entry function to be flexibleSam Clegg2018-05-141-7/+13
| | | | | | | | | 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] Add a flag to control merging data segmentsSam Clegg2018-05-101-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-7/+6
| | | | | | | | | | | | | | | --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-2/+2
| | | | | | | | | 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] Implement -print-gc-sections, to better test GC of globalsNicholas Wilson2018-04-201-1/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D44311 llvm-svn: 330456
* [WebAssembly] Implement --print-gc-sections for synthetic functionsNicholas Wilson2018-04-201-2/+3
| | | | | | | | | | 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] 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] 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-281-10/+5
| | | | | | This addresses a late review comment from D44427/rLLD328643 llvm-svn: 328700
* [WebAssembly] Add export/import for function pointer tableNicholas Wilson2018-03-271-0/+10
| | | | | | | | | | 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] Demangle symbol names for use by the browser debuggerNicholas Wilson2018-03-131-1/+5
| | | | | | Differential Revision: https://reviews.llvm.org/D44316 llvm-svn: 327392
* [WebAssembly] Add missing --demangle argNicholas Wilson2018-03-131-0/+1
| | | | | | | | | Previously, Config->Demangle was uninitialised (not hooked up to commandline handling) Differential Revision: https://reviews.llvm.org/D44301 llvm-svn: 327390
* [WebAssembly] Remove a second parameter from toString().Rui Ueyama2018-03-091-2/+1
| | | | | | | | | | | | toString(T) is a stringize function for an object of type T. Each type that has that function defined should know how to stringize itself, and there should be one string representation of an object. Passing a "supplemental" argument to toString() breaks that princple. We shouldn't add a second parameter to that function. Differential Revision: https://reviews.llvm.org/D44323 llvm-svn: 327182
* [WebAssembly] Handle weak undefined functions with a synthetic stubNicholas Wilson2018-03-091-0/+42
| | | | | | | | | This error case is described in Linking.md. The operand for call requires generation of a synthetic stub. Differential Revision: https://reviews.llvm.org/D44028 llvm-svn: 327151
* [WebAssembly] Refactor order of creation for SyntheticFunctionNicholas Wilson2018-03-091-1/+4
| | | | | | | | | | 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] Honor --allow-undefined even for explicit exportsSam Clegg2018-03-081-1/+1
| | | | | | | | | | | | | | | | When a symbol is exported via --export=foo but --allow-undefined is also specified, the symbol is now allowed to be undefined. Previously we were special casing such symbols. This combinations of behavior is exactly what emescripten requires. Although we are trying hard not to allow emscripten specific features in lld, this one makes sense. Enforce this behavior by added this case to test/wasm/undefined.ll. Differential Revision: https://reviews.llvm.org/D44237 llvm-svn: 326976
OpenPOWER on IntegriCloud