summaryrefslogtreecommitdiffstats
path: root/lld/wasm/Symbols.h
Commit message (Collapse)AuthorAgeFilesLines
...
* [WebAssembly] Remove a second parameter from toString().Rui Ueyama2018-03-091-1/+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-1/+1
| | | | | | | | | 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-5/+0
| | | | | | | | | | 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-3/+3
| | | | llvm-svn: 326896
* [WebAssembly] Reduce code repetition. NFC.Rui Ueyama2018-02-281-3/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D43910 llvm-svn: 326379
* [WebAssembly] Remove LastDefinedKind for consistency with undefined kinds. NFC.Rui Ueyama2018-02-281-6/+9
| | | | | | Differential Revision: https://reviews.llvm.org/D43711 llvm-svn: 326274
* [WebAssembly] Remove dead code.Rui Ueyama2018-02-241-1/+0
| | | | llvm-svn: 326018
* [WebAssembly] Add explicit symbol tableSam Clegg2018-02-231-17/+93
| | | | | | | | | | | | | | | | | | 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] Rename GlobalSymbol types. NFC.Sam Clegg2018-02-201-23/+23
| | | | | | | | | | | | | | | 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
* [WebAssembly] Remove InputChunk from Symbol baseclassSam Clegg2018-02-201-19/+17
| | | | | | | | | | Instead include InputFuction and InputSegment directly in the subclasses that use them (DefinedFunction and DefinedGlobal). Differential Revision: https://reviews.llvm.org/D43493 llvm-svn: 325603
* [WebAssembly] Remove unneeded classifer methods from Symbol class. NFC.Sam Clegg2018-02-171-5/+0
| | | | | | | | | We already have isa<> for this, and these methods were simply duplicating those redundantly. Differential Revision: https://reviews.llvm.org/D43422 llvm-svn: 325418
* [WebAssembly] Simplify FunctionSymbol::get/set/hasFunctionType. NFC.Sam Clegg2018-02-161-16/+12
| | | | | | Differential Revision: https://reviews.llvm.org/D43416 llvm-svn: 325415
* [WebAssebmly] Remove unneeded cast. NFC.Sam Clegg2018-02-161-1/+1
| | | | llvm-svn: 325382
* [WebAssembly] Fix bug is function signature checkingSam Clegg2018-02-161-1/+1
| | | | | | | | | | This bug effected undefined symbols that were resolved by existing defined symbols. We were skipping the signature check in this case. Differential Revision: https://reviews.llvm.org/D43399 llvm-svn: 325376
* [WebAssebmly] Remove use of Optional to fix assertion in gccSam Clegg2018-02-141-2/+6
| | | | | | | | | | | | | | This was causing GCC builds with fail with: Symbols.h:240:3: error: static assertion failed: Symbol types must be trivially destructible static_assert(std::is_trivially_destructible<T>( The reason this is a gcc-only failure is that OptionalStorage has as specialization for POD types that isn't built under GCC. Differential Revision: https://reviews.llvm.org/D43317 llvm-svn: 325185
* Revert r325158: Convert an assert to a static_assert. NFC.Rui Ueyama2018-02-141-2/+2
| | | | | | This reverts commit r325158 because it broke GCC builds. llvm-svn: 325183
* Remove a failing static_assert.Rui Ueyama2018-02-141-2/+0
| | | | | | | This static_assert is legitimate, but it is failing on some build environments. I'm removing it until it's fixed to unbreak the bots. llvm-svn: 325181
* Convert an assert to a static_assert. NFC.Sam Clegg2018-02-141-2/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D43305 llvm-svn: 325158
* [WebAssembly] Use a Symbol class heirarchy. NFC.Sam Clegg2018-02-141-27/+137
| | | | | | | | | This brings wasm into line with ELF and COFF in terms of symbol types are represented. Differential Revision: https://reviews.llvm.org/D43112 llvm-svn: 325150
* [WebAssembly] Add __data_end link-sythentic symbol.Sam Clegg2018-02-071-2/+9
| | | | | | | | | | | | | | This is similar to _end (See https://linux.die.net/man/3/edata for more) but using our own unique name since our use cases will most likely be different and we want to keep our options open WRT to memory layout. This change will allow is to remove the DataSize from the linking metadata section which is currently being used by emscripten to derive the end of the data. Differential Revision: https://reviews.llvm.org/D42867 llvm-svn: 324443
* [WebAssembly] Refactor linker-generated symbols. NFC.Sam Clegg2018-02-021-0/+19
| | | | | | | | | | | | 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
* clang formatSam Clegg2018-01-281-2/+1
| | | | llvm-svn: 323622
* [WebAssemly] Associate symbol with InputChunk in which they are defined. NFC.Sam Clegg2018-01-281-7/+5
| | | | | | | | | | | | | | | | Summary: Rather than explicit Function or InputSegment points store a pointer to the base class (InputChunk) and use llvm dynamic casts when we need a subtype. This change is useful for add the upcoming gc-section support wants to deal with all input chunks. Subscribers: aheejin, llvm-commits Differential Revision: https://reviews.llvm.org/D42625 llvm-svn: 323621
* [WebAssembly] Don't duplicate functions in table outputSam Clegg2018-01-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Previously, we were ensuring that the "output index" for InputFunctions was unique across all symbols that referenced a function body, but allowing the same function body to have multiple table indexes. Now, we use the same mechanism for table indexes as we already do for output indexes, ensuring that each InputFunction is only placed in the table once. This makes the LLD output table denser and smaller, but should not change the behaviour. Note that we still need the `Symbol::TableIndex` member, to store the table index for function Symbols that don't have an InputFunction, i.e. for address-taken imports. Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D42476 llvm-svn: 323379
* [WebAssembly] Simplify generation of "names" sectionSam Clegg2018-01-171-6/+1
| | | | | | | | | | | | | | | | Simplify generation of "names" section by simply iterating over the DefinedFunctions array. This even fixes some bugs, judging by the test changes required. Some tests are asserting that functions are named multiple times, other tests are asserting that the "names" section contains the function's alias rather than its original name Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D42076 llvm-svn: 322751
* [WebAssembly] Remove unused member variable. NFC.Sam Clegg2018-01-171-2/+1
| | | | | | Patch by Nicholas Wilson! llvm-svn: 322731
* [WebAssembly] Add --export flag to force a symbol to be exportedSam Clegg2018-01-121-0/+1
| | | | | | | | | | 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] Don't allow functions to be named more than onceSam Clegg2018-01-121-3/+3
| | | | | | | | | | Even though a function can have multiple names in the linking standards (i.e. due to aliases), there can only be one name for a given function in the NAME section. Differential Revision: https://reviews.llvm.org/D41975 llvm-svn: 322383
* [WebAssembly] Refactor symbol and symbol table to remove WasmSymbol referencesSam Clegg2018-01-101-11/+8
| | | | | | | | | | | | | | | This WasmSymbol types comes directly from the input objects but we want to be able to represent synthetic symbols too. This is more in line with how the ELF linker represents symbols. This change also removes the logic from Symbol::getVirtualAddress for finding the global address and instead has the InputFile provide this. Differential Revision: https://reviews.llvm.org/D41426 llvm-svn: 322145
* [WebAssembly] Output functions individuallySam Clegg2018-01-091-7/+7
| | | | | | | | | | | | | The code section is now written out one function at a time rather than all the functions in a given objects being serialized at once. This change lays the groundwork for supporting --gc-sections. Differential Revision: https://reviews.llvm.org/D41315 llvm-svn: 322138
* [WebAssembly] Write out undefined symbol addresses as zeroSam Clegg2018-01-081-5/+10
| | | | | | | | | | | | | The addresses of undefined symbols that make it into the final executable (i.e. weak references to non-existent symbols) should resolve to zero. Also, make sure to not include function in the indirect function table if they are not included in the output. Differential Revision: https://reviews.llvm.org/D41839 llvm-svn: 322045
* [WebAssembly] Base imports on Symtab. NFC.Sam Clegg2017-12-151-3/+0
| | | | | | | | | | | | | Since imports are undefined symbols we know we can find all of them my looking at the symbol table alone. (i.e. imports cannot be have local binding). This will be strictly faster and also allows us to to remove a method from Symbol class Differential Revision: https://reviews.llvm.org/D41304 llvm-svn: 320847
* [WebAssembly] De-dup indirect function table.Sam Clegg2017-12-111-0/+8
| | | | | | | | | | | | | | | | Create the indirect function table based on symbols rather than just duplicating the input entries. This has the effect of de-duplicating the table. This is a followup to the equivalent change made for globals: https://reviews.llvm.org/D40859 Partially based on a patch by Nicholas Wilson: https://reviews.llvm.org/D40845 Differential Revision: https://reviews.llvm.org/D40989 llvm-svn: 320428
* [WebAssembly] Add -u/--undefined argument handlingSam Clegg2017-12-071-0/+1
| | | | | | | | | | | | | | 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] Improve support linker synthetic symbolsSam Clegg2017-12-051-1/+4
| | | | | | | | | | | | | 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
* toString function take a const refs where possibleSam Clegg2017-12-051-2/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D40824 llvm-svn: 319787
* Reland "[WebAssembly] Add support for visibility flag""Sam Clegg2017-12-031-0/+1
| | | | | | | | Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish Differential Revision: https://reviews.llvm.org/D40773 llvm-svn: 319627
* [WebAssembly] Revert r319592 "Add support for visibility flag"Heejin Ahn2017-12-021-1/+0
| | | | | | | | | r319488 reportedly broke one of LLVM bots (ubuntu-gcc7.1-werror), and this patch depends on that patch. See http://lab.llvm.org:8011/builders/ubuntu-gcc7.1-werror/builds/3369 for details. llvm-svn: 319603
* [WebAssembly] Add support for visibility flagSam Clegg2017-12-011-0/+1
| | | | | | | | Patch by Nicholas Wilson Differential Revision: https://reviews.llvm.org/D40690 llvm-svn: 319592
* clang-format.Rui Ueyama2017-12-011-3/+3
| | | | llvm-svn: 319512
* [WebAssembly] Allow function signature checking at link timeSam Clegg2017-11-301-4/+9
| | | | | | | | | | | | | | 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/+113
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