summaryrefslogtreecommitdiffstats
path: root/lld/wasm/InputFiles.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [WebAssembly] Fix R_WEBASSEMBLY_FUNCTION_OFFSET_I32 relocation entriesSam Clegg2018-05-151-14/+4
| | | | | | | | | | | | | | | | | Fixes: lld: warning: unexpected existing value for R_WEBASSEMBLY_FUNCTION_OFFSET_I32: existing=839 expected=838 The existing solution is trying to erroneously recover correct offset of the function code from the body (which is not a function segment that includes its size, locals, and code). The D46763 is trying to maintain the offset of the function code allowing properly calculate the new relocation entry. Patch by Yury Delendik Differential Revision: https://reviews.llvm.org/D46765 llvm-svn: 332412
* [lld] Update uses of DEBUG macro to LLVM_DEBUG.Nicola Zaghen2018-05-151-5/+5
| | | | | | | | | | | The DEBUG() macro is very generic so it might clash with other projects. The renaming was done as follows: - git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g' - git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM Differential Revision: https://reviews.llvm.org/D44977 llvm-svn: 332351
* [WebAssembly] Add support for debug (DWARF) sectionsSam Clegg2018-05-041-6/+65
| | | | | | | | | | | | | | Specifically add support for custom sections that contain relocations, and for the two new relocation types needed by DWARF sections. See: https://reviews.llvm.org/D44184 Patch by Yury Delendik! Differential Revision: https://reviews.llvm.org/D44184 llvm-svn: 331566
* [WebAssembly] Implement -print-gc-sections, to better test GC of globalsNicholas Wilson2018-04-201-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D44311 llvm-svn: 330456
* [WebAssembly] Add support for custom sectionsSam Clegg2018-04-101-0/+2
| | | | | | | | | Copy user-defined custom sections into the output, concatenating sections with the same name. Differential Revision: https://reviews.llvm.org/D45340 llvm-svn: 329717
* [WebAssembly] Avoid COMDAT hashmap lookup for each symbol. NFCNicholas Wilson2018-03-141-3/+8
| | | | | | | | | 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] Fix expected contents of relocations with addendsSam Clegg2018-03-141-2/+3
| | | | | | | | | | | This fixes issues found on the wasm waterfall related to relocations with addends. Undefined symbols, even those with addends should always have a provisional value of zero. At least this is what llvm emits (and I believe this is true for ELF too). Differential Revision: https://reviews.llvm.org/D44451 llvm-svn: 327468
* [WebAssembly] Refactor to avoid conflating global and fucntion index space. NFCSam Clegg2018-03-121-2/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D44358 llvm-svn: 327326
* [WebAssembly] Verify contents of relocation target before writing itSam Clegg2018-03-121-0/+47
| | | | | | | | | | | | Verify that the location where a relocation is about the be applied contains the expected existing value. This is essentially a sanity check to catch bugs in the compiler and the linker. Differential Revision: https://reviews.llvm.org/D44349 llvm-svn: 327325
* [WebAssembly] Improve logging and comments around relocations. NFC.Sam Clegg2018-03-111-4/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D44350 llvm-svn: 327232
* [WebAssembly] Handle weak undefined functions with a synthetic stubNicholas Wilson2018-03-091-8/+2
| | | | | | | | | 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] Simplify createDefined. NFC.Rui Ueyama2018-03-021-10/+9
| | | | | | Differential Revision: https://reviews.llvm.org/D43849 llvm-svn: 326615
* [WebAssembly] Simplify COMDAT handling.Rui Ueyama2018-03-011-5/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D43966 llvm-svn: 326509
* [WebAssembly] Simplify initializeSymbols and merge it with ObjFile::parse. NFC.Rui Ueyama2018-02-281-64/+43
| | | | | | | | | | | This patch simplifies initializeSymbols. Since that function is called at the tail context of ObjFile::parse, and the function is called only once from that function, that's effectively just a continuation of ObjFile::parse. So this patch merge it with ObjFile::parse. Differential Revision: https://reviews.llvm.org/D43848 llvm-svn: 326296
* [WebAssembly] Refactor ObjFile::initializeSymbols.Rui Ueyama2018-02-281-62/+46
| | | | | | | | The main purpose of this change is to make initializeSymbols shorter. Differential Revision: https://reviews.llvm.org/D43691 llvm-svn: 326285
* [WebAssembly] Inline accessor functions that are called only once.Rui Ueyama2018-02-281-56/+19
| | | | | | | | | | | | Looks like these accessor functions are a bit overly defensive, and due to the amount of code, that part isn't easy to read. We have code to log translation results in writeTo and writeRelocations, so I don't think we need to log it again in these functions. I think the new function is much easier to understand. Differential Revision: https://reviews.llvm.org/D43713 llvm-svn: 326277
* [WebAssembly] Separate addUndefined into addUndefined{Function,Data,Global}.Rui Ueyama2018-02-281-3/+12
| | | | | | | | | | | | | | | 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
* Do not use `auto` for type that is not obvious in a local context.Rui Ueyama2018-02-241-2/+2
| | | | llvm-svn: 326012
* [WebAssembly] Add explicit symbol tableSam Clegg2018-02-231-114/+96
| | | | | | | | | | | | | | | | | | 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-17/+17
| | | | | | | | | | | | | | | 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
* [WebAssembly] Split addDefined into two different methods. NFC.Sam Clegg2018-02-201-2/+2
| | | | | | | | Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D43496 llvm-svn: 325613
* [WebAssembly] Simplify FunctionSymbol::get/set/hasFunctionType. NFC.Sam Clegg2018-02-161-7/+7
| | | | | | Differential Revision: https://reviews.llvm.org/D43416 llvm-svn: 325415
* Remove `else` after `break`.Rui Ueyama2018-02-161-6/+4
| | | | llvm-svn: 325387
* [WebAssembly] Use a Symbol class heirarchy. NFC.Sam Clegg2018-02-141-15/+20
| | | | | | | | | 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] Unify concepts of discarded and non-live input chunks. NFC.Sam Clegg2018-02-131-2/+2
| | | | | | | | | It seems redundant to store this information twice. None of the locations where this bit is checked care about the distinction. Differential Revision: https://reviews.llvm.org/D43250 llvm-svn: 325046
* [WebAssembly] Remove redundant check global output indexSam Clegg2018-02-091-1/+1
| | | | llvm-svn: 324715
* [WebAssembly] Write minimal types sectionSam Clegg2018-01-311-0/+4
| | | | | | | | | | | | | | | | | | Don't include type signatures that are not referenced by some relocation. We don't include this in the -gc-sections settings since we are always building the type section from scratch, just like we do the table elements. In the future we might want to unify the relocation processing which is currently done once for gc-sections and then again for building the sympathetic type and table sections. Differential Revision: https://reviews.llvm.org/D42747 llvm-svn: 323931
* [WebAssembly] Update to match llvm change rL323901. NFCSam Clegg2018-01-311-3/+3
| | | | | | | | | | See: https://reviews.llvm.org/rL323901 Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D42751 llvm-svn: 323903
* [WebAssembly] Add support for --gc-sectionsSam Clegg2018-01-311-4/+4
| | | | | | | | | | | | | | | 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
* clang formatSam Clegg2018-01-281-4/+3
| | | | 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] Update to match llvm changes to TABLE relocationsSam Clegg2018-01-231-24/+25
| | | | | | | | | | | | | TABLE relocations now store the function that is being refered to indirectly. See rL323165. Also extend the call-indirect.ll a little. Based on a patch by Nicholas Wilson! llvm-svn: 323168
* [WebAssembly] Allow non-zero table offset in input objectSam Clegg2018-01-191-3/+3
| | | | | | | | | | Summary: This change enables D42284 to land without breaking lld Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D42285 llvm-svn: 322976
* [WebAssembly] Remove DEBUG_FUNCTION_NAME after llvm changeSam Clegg2018-01-171-3/+0
| | | | | | | | Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D42193 llvm-svn: 322745
* [WebAssembly] Add COMDAT supportSam Clegg2018-01-121-11/+38
| | | | | | | | | | | | | | | | | | 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-6/+2
| | | | | | | | | | | 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] Move relocation handling InputChunks.cppSam Clegg2018-01-101-0/+23
| | | | | | | | | Teach each input chunk how to write itself and apply its own relocations. Differential Revision: https://reviews.llvm.org/D41891 llvm-svn: 322212
* [WebAssembly] Add InputChunk as common base class for InputSegment and ↵Sam Clegg2018-01-101-16/+5
| | | | | | | | 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-17/+23
| | | | | | | | | | | | | | | 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-43/+58
| | | | | | | | | | | | | 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-2/+2
| | | | | | | | | | | | | 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
* [WebAssmebly] Fix references to weak aliasesSam Clegg2017-12-211-0/+9
| | | | | | | | Corresponding LLVM change: https://reviews.llvm.org/D41472 Differential Revision: https://reviews.llvm.org/D41473 llvm-svn: 321244
* [WebAssembly] Move code for copying of data segment relocation. NFC.Sam Clegg2017-12-171-2/+15
| | | | | | | | | This is a preparetory change for function gc which also requires relocations to be copied in ranges like this. Differential Revision: https://reviews.llvm.org/D41313 llvm-svn: 320948
* Fix error messages.Rui Ueyama2017-12-151-1/+1
| | | | llvm-svn: 320772
* [WebAssembly] De-dup indirect function table.Sam Clegg2017-12-111-9/+36
| | | | | | | | | | | | | | | | 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] Fix symbol exports under -r/--relocatableSam Clegg2017-12-071-17/+6
| | | | | | | | | | | | | | | 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
* Always evaluate the second argument for CHECK() lazily.Rui Ueyama2017-12-061-4/+4
| | | | | | | | | This patch is to rename check CHECK and make it a C macro, so that we can evaluate the second argument lazily. Differential Revision: https://reviews.llvm.org/D40915 llvm-svn: 319974
* [WebAssembly] Remove wasm/Strings.cpp+hSam Clegg2017-12-061-2/+1
| | | | | | | | | 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
* toString function take a const refs where possibleSam Clegg2017-12-051-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D40824 llvm-svn: 319787
OpenPOWER on IntegriCloud