summaryrefslogtreecommitdiffstats
path: root/llvm/test/MC/WebAssembly
Commit message (Collapse)AuthorAgeFilesLines
...
* [WebAssembly] MC: Use inline triple in test bitcode filesSam Clegg2018-01-2317-18/+54
| | | | | | | | | This matches the CodeGen tests and makes it a little easy to run these from the command line manually. Differential Revision: https://reviews.llvm.org/D42440 llvm-svn: 323275
* [WebAssembly] Add to test expectations for ↵Sam Clegg2018-01-231-2/+7
| | | | | | | | test/MC/WebAssembly/weak-alias.ll. NFC. Split out from D42095 llvm-svn: 323272
* [WebAssembly] Remove "name" section of object wasm object filesSam Clegg2018-01-236-58/+0
| | | | | | | | | | | | | LLD is unaffected, no changes needed there. LLD continues to write out a name section, using the symbol names. Fixes: https://github.com/WebAssembly/tool-conventions/issues/37 Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D42425 llvm-svn: 323234
* [WebAssembly] Store function index rather than table index in TABLE_INDEX ↵Sam Clegg2018-01-234-5/+5
| | | | | | | | | | | | | | | | | | | | | relocations Relocations of type R_WEBASSEMBLY_TABLE_INDEX represent places where the table index for a given function is needed. While the value stored in this location is a table index, the index in the relocation entry itself is a function index (the index of the function which is to be called indirectly). This is how is was spec'd originally but the LLVM implementation didn't do this. This makes things a little simpler in the linker since the table in the input file can essentially be ignored that the output table can be created purely based on these relocations. Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D42080 llvm-svn: 323165
* [WebAssembly] MC: Start table at offset 1 rather than 0Sam Clegg2018-01-194-12/+12
| | | | | | | | | | | | | | | Summary: For consistency with the output of lld. This is useful in runnable binaries as can them be sure the null function pointer will never be a valid argument call_indirect. Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D42284 llvm-svn: 322978
* [WebAssembly] Remove debug names from symbol tableSam Clegg2018-01-171-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | Get rid of DEBUG_FUNCTION_NAME symbols. When we actually debug data, maybe we'll want somewhere to put it... but having a symbol that just stores the name of another symbol seems odd. It means you have multiple Symbols with the same name, one containing the actual function and another containing the name! Store the names in a vector on the WasmObjectFile when reading them in. Also stash them on the WasmFunctions themselves. The names are //not// "symbol names" or aliases or anything, they're just the name that a debugger should show against the function body itself. NB. The WasmObjectFile stores them so that they can be exported in the YAML losslessly, and hence the tests can be precise. Enforce that the CODE section has been read in before reading the "names" section. Requires minor adjustment to some tests. Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D42075 llvm-svn: 322741
* [WebAssemlby] MC: Don't write COMDAT symbols as global importsSam Clegg2018-01-111-2/+36
| | | | | | | | This was causing undefined references at link time in lld. Differential Revision: https://reviews.llvm.org/D41959 llvm-svn: 322309
* [WebAssemly] Rename and improve formatting for ctor/dtor testSam Clegg2018-01-111-3/+8
| | | | llvm-svn: 322307
* [WebAssembly] Add COMDAT supportSam Clegg2018-01-091-0/+99
| | | | | | | | | | | | | | This adds COMDAT support to the Wasm object-file format. Spec: https://github.com/WebAssembly/tool-conventions/pull/31 Corresponding LLD change: https://bugs.llvm.org/show_bug.cgi?id=35533, and D40845 Patch by Nicholas Wilson Differential Revision: https://reviews.llvm.org/D40844 llvm-svn: 322135
* [WebAssembly] MC: Use zero for provisional value of undefined symbolsSam Clegg2018-01-092-3/+3
| | | | | | | | | | This is more in line with what happens in the final executable when symbols are undefined (i.e. weak references). Differential Revision: https://reviews.llvm.org/D41840 llvm-svn: 322130
* [WebAssembly] Explicitly specify function/global index space in YAMLSam Clegg2018-01-095-25/+50
| | | | | | | | | | | These indexes are useful because they are not always zero based and functions and globals are referenced elsewhere by their index. This matches what we already do for the type index space. Differential Revision: https://reviews.llvm.org/D41877 llvm-svn: 322121
* [WebAssembly] MC: Fix for address taken aliasesSam Clegg2017-12-221-28/+118
| | | | | | | | | | | | | | Previously, taking the address for an alias would result in: "Symbol not found in table index space" Increase test coverage for weak aliases. This code should be more efficient too as it avoids building the `IsAddressTaken` set. Differential Revision: https://reviews.llvm.org/D41510 llvm-svn: 321384
* [WebAssembly] Fix local references to weak aliasesSam Clegg2017-12-211-18/+39
| | | | | | | | | | | | | | | | When weak aliases are used with in same translation unit we need to be able to directly reference to alias and not just the thing it is aliases. We do this by defining both a wasm import and a wasm export in this case that result in a single Symbol. This change is a partial revert of rL314245. A corresponding lld change address the previous issues we had with this. See: https://github.com/WebAssembly/tool-conventions/issues/34 Differential Revision: https://reviews.llvm.org/D41472 llvm-svn: 321242
* [WebAssembly] Implement @llvm.global_ctors and @llvm.global_dtorsSam Clegg2017-12-151-39/+112
| | | | | | | | | | | | | | | Summary: - lowers @llvm.global_dtors by adding @llvm.global_ctors functions which register the destructors with `__cxa_atexit`. - impements @llvm.global_ctors with wasm start functions and linker metadata See [here](https://github.com/WebAssembly/tool-conventions/issues/25) for more background. Subscribers: jfb, dschuff, mgorny, jgravelle-google, aheejin, sunfish Differential Revision: https://reviews.llvm.org/D41211 llvm-svn: 320774
* [WebAssembly] Use bitfield types in wasm YAML representationSam Clegg2017-12-138-27/+27
| | | | | | Differential Revision: https://reviews.llvm.org/D41202 llvm-svn: 320642
* Reland "[WebAssembly] Import the linear memory and function table."Sam Clegg2017-12-118-32/+39
| | | | | | Original change: https://reviews.llvm.org/D40875 llvm-svn: 320432
* Revert "[WebAssembly] Import the linear memory and function table."Sam Clegg2017-12-078-39/+32
| | | | | | | | | We need to a little time to prepare and lld-side change that supports this. Original change: https://reviews.llvm.org/D40875 llvm-svn: 320003
* [WebAssembly] section kind can be codeSam Clegg2017-12-071-0/+9
| | | | | | | | | | | | | Currently, when creating a named section, the Wasm frontend forces it to use `SectionKind::Data`, whereas in fact C++ does generate code sections with custom names. Patch by Nicholas Wilson Differential Revision: https://reviews.llvm.org/D40906 llvm-svn: 320002
* [WebAssembly] Import the linear memory and function table.Dan Gohman2017-12-068-32/+39
| | | | | | | | | | | | Instead of having .o files contain linear-memory and function table definitions, use imports. This is more consistent with the stack pointer being imported, and it's consistent with the linker being the one to decide whether linear memory and function table are imported or defined in the linked output. This implements tool-conventions #23. Differential Revision: https://reviews.llvm.org/D40875 llvm-svn: 319989
* [WebAssembly] Fix test breakage from r319810Derek Schuff2017-12-061-1/+1
| | | | llvm-svn: 319865
* Reland "[WebAssembly] Add visibility flag to Wasm symbol flags""Sam Clegg2017-12-031-0/+23
| | | | | | | | | | Original change was rL319488. This was reverted rL319602 due to a gcc 7.1 warning. Differential Revision: https://reviews.llvm.org/D40772 llvm-svn: 319626
* [WebAssembly] Revert r319488 "Add visibility flag to Wasm symbol flags"Heejin Ahn2017-12-021-23/+0
| | | | | | | | | This patch reportedly broke one of LLVM bots (ubuntu-gcc7.1-werror). See http://lab.llvm.org:8011/builders/ubuntu-gcc7.1-werror/builds/3369 for details. llvm-svn: 319602
* [WebAssembly] Update MC tests now that hidden attr is supportedSam Clegg2017-12-013-7/+14
| | | | | | | | | | | | Summary: Support was added in rL319488 but these tests were not updated. Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish Differential Revision: https://reviews.llvm.org/D40693 llvm-svn: 319510
* Add visibility flag to Wasm symbol flagsSam Clegg2017-11-301-0/+23
| | | | | | | | | | | | | | The LLVM "hidden" flag needs to be passed through the Wasm intermediate objects in order for the linker to apply it to the final Wasm object. The corresponding change in LLD is here: https://github.com/WebAssembly/lld/pull/14 Patch by Nicholas Wilson Differential Revision: https://reviews.llvm.org/D40442 llvm-svn: 319488
* [WebAssembly] MC: Don't allow zero sized data segmentsSam Clegg2017-10-271-2/+73
| | | | | | | | | | | This ensures that each segment has a unique address. Without this, consecutive zero sized symbols would end up with the same address and the linker cannot map symbols to unique data segments. Differential Revision: https://reviews.llvm.org/D39107 llvm-svn: 316717
* [WebAssembly] MC: Fix crash when -g specified.Sam Clegg2017-10-201-0/+41
| | | | | | | | | At this point we don't output any debug sections or thier relocations. Differential Revision: https://reviews.llvm.org/D39076 llvm-svn: 316240
* Fix expectations in MC wasm init-fini-array testReid Kleckner2017-10-031-2/+7
| | | | llvm-svn: 314823
* [WebAssembly] MC: Support for init_array and fini_arraySam Clegg2017-10-031-0/+96
| | | | | | Differential Revision: https://reviews.llvm.org/D37757 llvm-svn: 314783
* [WebAssembly] Allow each data segment to specify its own alignmentSam Clegg2017-09-296-11/+27
| | | | | | | | | Also, add a flags field as we will almost certainly be needing that soon too. Differential Revision: https://reviews.llvm.org/D38296 llvm-svn: 314534
* [WebAssembly] Model weakly defined symbols as wasm exportsSam Clegg2017-09-261-32/+35
| | | | | | | | | | | | | Previously these were being included as both imports and exports, with the import being satisfied by the export (or some strong symbol) at runtime. However proved unnecessary and actually complicated linking as it meant there was not a 1-to-1 mapping between a wasm function /global index and a linker symbol. Differential Revision: https://reviews.llvm.org/D38246 llvm-svn: 314245
* [WebAssembly] Weak symbols should be defined in SF_GlobalSam Clegg2017-09-201-1/+14
| | | | | | | | | | | | Summary: This manifested itself in lld since it meant that weak symbols were not appearing in archive symbol tables. Subscribers: jfb, dschuff, jgravelle-google, aheejin Differential Revision: https://reviews.llvm.org/D38111 llvm-svn: 313838
* [WebAssembly] Add support for local symbol bindingsSam Clegg2017-09-201-3/+14
| | | | | | Differential Revision: https://reviews.llvm.org/D38096 llvm-svn: 313817
* Reland "[WebAssembly] Add support for naming wasm data segments"Sam Clegg2017-09-205-3/+58
| | | | | | | | | Add adds support for naming data segments. This is useful useful linkers so that they can merge similar sections. Differential Revision: https://reviews.llvm.org/D37886 llvm-svn: 313795
* Reverting due to Green Dragon bot failure.Mike Edwards2017-09-205-58/+3
| | | | | | http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/42594/ llvm-svn: 313706
* [WebAssembly] Add support for naming wasm data segmentsSam Clegg2017-09-195-3/+58
| | | | | | | | | Add adds support for naming data segments. This is useful useful linkers so that they can merge similar sections. Differential Revision: https://reviews.llvm.org/D37886 llvm-svn: 313692
* [WebAssembly] MC: Create wasm data segments based on MCSectionsSam Clegg2017-09-151-0/+65
| | | | | | | | | | | This means that we can honor -fdata-sections rather than always creating a segment for each symbol. It also allows for a followup change to add .init_array and friends. Differential Revision: https://reviews.llvm.org/D37876 llvm-svn: 313395
* [WebAssembly] MC: Fix crash in getProvitionalValue on weak referencesSam Clegg2017-09-151-3/+43
| | | | | | | | | - Create helper function for resolving weak references. - Add test that preproduces the crash. Differential Revision: https://reviews.llvm.org/D37916 llvm-svn: 313381
* [WebAssembly] Use a separate wasm data segment for each global symbolSam Clegg2017-09-143-33/+75
| | | | | | | | | | This is stepping stone towards honoring -fdata-sections and letting the assembler decide how many wasm data segments to create. Differential Revision: https://reviews.llvm.org/D37834 llvm-svn: 313313
* [WebAssembly] Only treat imports/exports as symbols when reading relocatable ↵Sam Clegg2017-09-061-1/+0
| | | | | | | | | | | | | | | | | | | object files This change only treats imported and exports functions and globals as symbol table entries the object has a "linking" section (i.e. it is relocatable object file). In this case all globals must be of type I32 and initialized with i32.const. This was previously being assumed but not checked for and was causing a failure on big endian machines due to using the wrong value of then union. See: https://bugs.llvm.org/show_bug.cgi?id=34487 Differential Revision: https://reviews.llvm.org/D37497 llvm-svn: 312674
* [WebAssembly] Update relocation names to match specSam Clegg2017-09-014-7/+7
| | | | | | | | Summary: See https://github.com/WebAssembly/tool-conventions/blob/master/Linking.md Differential Revision: https://reviews.llvm.org/D37385 llvm-svn: 312342
* [WebAssembly] Expose the offset of each data segmentSam Clegg2017-07-122-2/+4
| | | | | | | | | | | | | | Summary: This allows tools like lld that process relocations to apply data relocation correctly. This information is required because relocation are stored as section offset. Subscribers: jfb, dschuff, jgravelle-google, aheejin Differential Revision: https://reviews.llvm.org/D35234 llvm-svn: 307741
* [WebAssembly] Use the correct size for MCFillFragmentSam Clegg2017-07-101-0/+14
| | | | | | | | | | | Summary: When implementing MCFillFragment, use the size of the fragment, rather than the size of the section. Patch by Dan Gohman Differential Revision: https://reviews.llvm.org/D35090 llvm-svn: 307565
* [WebAssembly] Support weak defined symbolsSam Clegg2017-07-071-5/+27
| | | | | | | | | | | | Model weakly defined symbols as symbols that are both exports and imported and marked as weak. Local references to the symbols refer to the import but the linker can resolve this to the weak export if not strong symbol is found at link time. Differential Revision: https://reviews.llvm.org/D35029 llvm-svn: 307348
* [WebAssembly] Fix types for address taken functionsSam Clegg2017-07-051-20/+29
| | | | | | Differential Revision: https://reviews.llvm.org/D34966 llvm-svn: 307198
* [WebAssembly] MC: Don't generate extra types for weak aliasSam Clegg2017-07-051-1/+8
| | | | | | | | | | Previously we were generating a void(void) function type for a weak alias. Update the weak-alias test case to catch this. Differential Revision: https://reviews.llvm.org/D34734 llvm-svn: 307194
* [WebAssembly] Add data size and alignement to linking sectionSam Clegg2017-06-273-44/+54
| | | | | | | | | The overal size of the data section (including BSS) is otherwise not included in the wasm binary. Differential Revision: https://reviews.llvm.org/D34657 llvm-svn: 306459
* [WebAssembly] Add more support for weak symbolsSam Clegg2017-06-262-0/+67
| | | | | | | | | Add weak symbol tests to MC Add symbol flags to output of `llvm-readobj -t`. Differential Revision: https://reviews.llvm.org/D34635 llvm-svn: 306330
* [WebAssembly] Use __stack_pointer global when writing wasm binarySam Clegg2017-06-162-3/+23
| | | | | | | | | | | | | | | | | | This ensures that symbolic relocations are generated for stack pointer manipulations. These relocations are of type R_WEBASSEMBLY_GLOBAL_INDEX_LEB. This change also adds support for reading relocations of this type in WasmObjectFile.cpp. Since its a globally imported symbol this does mean that the get_global/set_global instruction won't be valid until the objects are linked that global used in no longer an imported global. Differential Revision: https://reviews.llvm.org/D34172 llvm-svn: 305616
* [WebAssembly] Fix symbol type for addresses of external functionsSam Clegg2017-06-132-2/+27
| | | | | | | | | | | | | | These symbols were previously not being marked as functions so were appearing as globals instead, and with the incorrect relocation type. Without this fix, objects that take address of external functions include them as global imports rather than function imports which then fails at link time. Differential Revision: https://reviews.llvm.org/D34068 llvm-svn: 305263
* [WebAssembly] MC: Fix value of R_WEBASSEMBLY_TABLE_INDEX relocationsSam Clegg2017-06-121-0/+48
| | | | | | | | | | | | | Previously we were writing the value function index space value but for these types of relocations we want to be writing the table element index space value. Add a test case for these relocation types that fails without this change. Differential Revision: https://reviews.llvm.org/D33962 llvm-svn: 305253
OpenPOWER on IntegriCloud