summaryrefslogtreecommitdiffstats
path: root/lld/wasm/SymbolTable.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [WebAssembly] Check function signatures by defaultSam Clegg2018-05-051-7/+4
| | | | | | | | | But only produce a warning (for now) unless --fatal-warnings is passed. Differential Revision: https://reviews.llvm.org/D46484 llvm-svn: 331574
* [WebAssembly] Avoid COMDAT hashmap lookup for each symbol. NFCNicholas Wilson2018-03-141-2/+2
| | | | | | | | | 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] Refactor order of creation for SyntheticFunctionNicholas Wilson2018-03-091-3/+6
| | | | | | | | | | 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] Simplify COMDAT handling.Rui Ueyama2018-03-011-14/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D43966 llvm-svn: 326509
* Use DenseMap::lookup() instead of find() and a hand-written null check.Rui Ueyama2018-02-281-4/+1
| | | | llvm-svn: 326382
* [WebAssembly] Reduce code repetition. NFC.Rui Ueyama2018-02-281-18/+10
| | | | | | Differential Revision: https://reviews.llvm.org/D43910 llvm-svn: 326379
* [WebAssembly] Separate addUndefined into addUndefined{Function,Data,Global}.Rui Ueyama2018-02-281-111/+125
| | | | | | | | | | | | | | | Previously, one function adds all types of undefined symbols. That doesn't fit to the wasm's undefined symbol semantics well because different types of undefined symbols are very different in wasm. As a result, separate control flows merge in this addUndefined function and then separate again for each type. That wasn't easy to read. This patch separates the function into three functions. Now it is pretty clear what we are doing for each undefined symbol type. Differential Revision: https://reviews.llvm.org/D43697 llvm-svn: 326271
* [WebAssembly] Add explicit symbol tableSam Clegg2018-02-231-44/+86
| | | | | | | | | | | | | | | | | | 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-9/+10
| | | | | | | | | | | | | | | 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
* Consistent (non) use of empty lines in include blocksSam Clegg2018-02-201-1/+0
| | | | | | | | | The profailing style in lld seem to be to not include such empty lines. Clang-tidy/clang-format seem to handle this just fine. Differential Revision: https://reviews.llvm.org/D43528 llvm-svn: 325629
* Use more early returns in SymbolTable.cpp.Rui Ueyama2018-02-201-33/+46
| | | | | | | | | | | I think if statements that end with return is easier to read than cascaded if-else-if-else-if statements because it makes clear that execution of a function terminates there. This patch also adds more blank lines to separate code blocks to meaningful pieces. Differential Revision: https://reviews.llvm.org/D43517 llvm-svn: 325625
* feedbackSam Clegg2018-02-201-15/+8
| | | | llvm-svn: 325614
* [WebAssembly] Split addDefined into two different methods. NFC.Sam Clegg2018-02-201-36/+47
| | | | | | | | Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D43496 llvm-svn: 325613
* [WebAssembly] Check signatures of weakly defined funtions tooSam Clegg2018-02-201-0/+1
| | | | | | | | Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D43492 llvm-svn: 325598
* [WebAssembly] Remove unneeded classifer methods from Symbol class. NFC.Sam Clegg2018-02-171-2/+2
| | | | | | | | | 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-6/+9
| | | | | | Differential Revision: https://reviews.llvm.org/D43416 llvm-svn: 325415
* [WebAssembly] Use a Symbol class heirarchy. NFC.Sam Clegg2018-02-141-59/+54
| | | | | | | | | 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
* Use LLVM's SetVector insteead of unordered_set.Rui Ueyama2018-02-131-3/+2
| | | | | | | | | SetVector guarantees ordering, so with that we can get a deterministic output for error messages. Differential Revision: https://reviews.llvm.org/D43254 llvm-svn: 325064
* [WebAssembly] Cleanup methods for add synthetic symbols to symbtab. NFC.Sam Clegg2018-02-131-23/+11
| | | | | | | | | | | | These were duplicating (incorrectly) some of the logic for handling conflicts, but since they are only ever added right at the start we can assume no existing symbols. Also rename these methods for clarity. Differential Revision: https://reviews.llvm.org/D43252 llvm-svn: 325045
* clang formatSam Clegg2018-01-281-4/+4
| | | | llvm-svn: 323622
* [WebAssemly] Associate symbol with InputChunk in which they are defined. NFC.Sam Clegg2018-01-281-8/+15
| | | | | | | | | | | | | | | | 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] Remove special handling of entry point export.Sam Clegg2018-01-201-2/+9
| | | | | | | | | | | | Its much easier to export it via setHidden(false), now that that is a thing. As a side effect the start function is not longer always exports first (becuase its being exported just like all the other function). Differential Revision: https://reviews.llvm.org/D42321 llvm-svn: 323025
* [WebAssembly] Remove redundant function: addSyntheticUndefinedFunction. NFC.Sam Clegg2018-01-201-0/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D42327 llvm-svn: 323024
* [WebAssembly] Add COMDAT supportSam Clegg2018-01-121-0/+16
| | | | | | | | | | | | | | | | | | See https://bugs.llvm.org/show_bug.cgi?id=35533, and D40844 Things covered: * Removing duplicate data segments (as determined by COMDATs emitted by the frontend) * Removing duplicate globals and functions in COMDATs * Checking that each time a COMDAT is seen it has the same symbols as at other times (ie it's a stronger check than simply giving all the symbols in the COMDAT weak linkage) Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D40845 llvm-svn: 322415
* [WebAssembly] Create synthetic __wasm_call_ctors functionSam Clegg2018-01-121-0/+16
| | | | | | | | | | | 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] Add InputChunk as common base class for InputSegment and ↵Sam Clegg2018-01-101-1/+1
| | | | | | | | InputFunction. NFC. Differential Revision: https://reviews.llvm.org/D41419 llvm-svn: 322148
* [WebAssembly] Refactor symbol and symbol table to remove WasmSymbol referencesSam Clegg2018-01-101-34/+30
| | | | | | | | | | | | | | | 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-27/+17
| | | | | | | | | | | | | 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
* [WebAssmebly] Fix references to weak aliasesSam Clegg2017-12-211-9/+1
| | | | | | | | Corresponding LLVM change: https://reviews.llvm.org/D41472 Differential Revision: https://reviews.llvm.org/D41473 llvm-svn: 321244
* [WebAssembly] Fix typoSam Clegg2017-12-191-2/+2
| | | | | | Patch by Nicholas Wilson llvm-svn: 321097
* [WebAssembly] Add -u/--undefined argument handlingSam Clegg2017-12-071-0/+4
| | | | | | | | | | | | | | 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] Fix symbol exports under -r/--relocatableSam Clegg2017-12-071-2/+2
| | | | | | | | | | | | | | | This change cleans up the way wasm exports and globals are generated, particualrly for -r/--relocatable where globals need to be created and exported in order for output relocations which reference them. Remove the need for a per file GlobalIndexOffset and instead set the output index for each symbol directly. This simplifies the code in several places. Differential Revision: https://reviews.llvm.org/D40859 llvm-svn: 320001
* [WebAssembly] Remove wasm/Strings.cpp+hSam Clegg2017-12-061-3/+2
| | | | | | | | | This file contained only a single function that was only really needed in one place, so just inline it. Differential Revision: https://reviews.llvm.org/D40870 llvm-svn: 319876
* [WebAssembly] Fix typosSam Clegg2017-12-011-3/+3
| | | | | | | | Patch by Nicholas Wilson Differential Revision: https://reviews.llvm.org/D40691 llvm-svn: 319506
* [WebAssembly] Allow function signature checking at link timeSam Clegg2017-11-301-21/+75
| | | | | | | | | | | | | | 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
* Move Memory.{h,cpp} to Common.Rui Ueyama2017-11-281-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D40571 llvm-svn: 319221
* Rename `Symtab` private memory to avoid confusion with global `Symtab`Sam Clegg2017-11-271-4/+4
| | | | | | | | | | | This is also consistent with SymVector that exists in COFF port and soon to be added to the wasm port. Split off as part of https://reviews.llvm.org/D40371 Differential Revision: https://reviews.llvm.org/D40525 llvm-svn: 319113
* Consistent use of <internal> when displaying internal symbol namesSam Clegg2017-11-271-7/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D40510 llvm-svn: 319108
* [WebAssembly] Initial wasm linker implementationSam Clegg2017-11-171-0/+191
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