summaryrefslogtreecommitdiffstats
path: root/lld/wasm/SymbolTable.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [lld] Fix trivial typos in commentsKazuaki Ishizaki2020-01-061-5/+6
| | | | | | Reviewed By: ruiu, MaskRay Differential Revision: https://reviews.llvm.org/D72196
* [lld][WebAssebmly] Preserve custom import attributes with LTOSam Clegg2019-10-171-1/+33
| | | | | | | | | | | | | | | | | | | Undefined symbols in WebAssembly can come with custom `import-module` and `import-field` attributes. However when reading symbols from bitcode object files during LTO those curtom attributes are not available. Once we compile the LTO object and read in the symbol table from the object file we have access to these custom attributes. In this case, when undefined symbols are added and a symbol already exists in the SymbolTable we can't simple return it, we may need to update the symbol's attributes. Fixes: PR43211 Differential Revision: https://reviews.llvm.org/D68959 llvm-svn: 375081
* [WebAssembly] Wrap definitions in namespace lld { namespace wasm {. NFCFangrui Song2019-10-101-3/+6
| | | | | | | | | | Similar to D68323, but for wasm. Reviewed By: ruiu Differential Revision: https://reviews.llvm.org/D68759 llvm-svn: 374279
* [lld][WebAssembly] Preserve symbol flags in --relocatable outputSam Clegg2019-09-231-0/+3
| | | | | | | | Fixes https://github.com/emscripten-core/emscripten/issues/8879 Differential Revision: https://reviews.llvm.org/D67729 llvm-svn: 372660
* [lld][WebAssembly] Fix spurious signature mismatch warningsSam Clegg2019-08-301-2/+9
| | | | | | | | | | | | | | | | | | | Summary: This a follow up on: https://reviews.llvm.org/D62153 Handle the case where there are multiple object files that contain undefined references to the same function. We only generate a function variant if the existing symbol is directly called. See: https://github.com/emscripten-core/emscripten/issues/8995 Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D67015 llvm-svn: 370509
* [lld][WebAssembly] Add optional symbols after input file handlingSam Clegg2019-08-081-3/+3
| | | | | | | | | | | | | | This allows undefined references in input files be resolved by the optional symbols. Previously we were doing this before input file reading which means it was working only for command line symbols references (i.e. -u or --export). Also use addOptionalDataSymbol for __dso_handle and make all optional symbols hidden by default. Differential Revision: https://reviews.llvm.org/D65920 llvm-svn: 368310
* [Coding style change][lld] Rename variables for non-ELF portsRui Ueyama2019-07-111-375/+375
| | | | | | | | | | | This patch does the same thing as r365595 to other subdirectories, which completes the naming style change for the entire lld directory. With this, the naming style conversion is complete for lld. Differential Revision: https://reviews.llvm.org/D64473 llvm-svn: 365730
* Make functions and member variables distinguishable even after the name ↵Rui Ueyama2019-07-101-19/+19
| | | | | | style change. NFC. llvm-svn: 365605
* [lld][WebAssembly] Report undefined symbols during scanRelocationsSam Clegg2019-07-091-13/+0
| | | | | | | | | | | | | | | | This puts handling of undefined symbols in a single location. Its also more in line with the ELF backend which only reports undefined symbols based on relocations. One side effect is that we no longer report undefined symbols that are only referenced in GC'd sections. This also fixes a crash reported in the emscripten toolchain: https://github.com/emscripten-core/emscripten/issues/8930. Differential Revision: https://reviews.llvm.org/D64280 llvm-svn: 365553
* [lld][WebAssembly] Fix __start/__stop symbols when combining input segmentsSam Clegg2019-07-081-0/+1
| | | | | | | | | | | | We should be generating one __start/__stop pair per output segment not per input segment. The test wasn't catching this because it was only linking a single object file. Fixes PR41565 Differential Revision: https://reviews.llvm.org/D64148 llvm-svn: 365308
* [WebAssembly] Handle object parsing more like the ELF backendSam Clegg2019-06-051-6/+22
| | | | | | Differential Revision: https://reviews.llvm.org/D62886 llvm-svn: 362626
* [WebAssembly] Add comment as follow-up to rL362276. NFC.Sam Clegg2019-06-041-1/+3
| | | | | | | | | | Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62824 llvm-svn: 362522
* [WebAssembly] Don't export __data_end and __heap_base by default.Sam Clegg2019-05-311-1/+4
| | | | | | | | These can still be exported via --export if needed. Differential Revision: https://reviews.llvm.org/D62744 llvm-svn: 362276
* [WebAssembly] Fix signatures of undefined function in LTO object which are ↵Sam Clegg2019-05-291-8/+10
| | | | | | | | | | | | | not called directly. We recently added special handling for function that are not called directly but failed to add testing for the LTO case. See https://reviews.llvm.org/D62153 Differential Revision: https://reviews.llvm.org/D62561 llvm-svn: 361975
* [WebAssembly] Relax signature checking for undefined functions that are not ↵Sam Clegg2019-05-241-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | called directly When function signatures don't match and the undefined function is not called directly (i.e. only has its address taken) we don't issue a warning or create a runtime thunk for the undefined function. Instead in this case we simply use the defined version of the function. This is possible since checking signatures of dynamic calls happens at runtime so any invalid usage will still result in a runtime error. This is needed to allow C++ programs to link without generating warnings. Its not uncommon in C++ for vtables to be populated by function address whee the signature of the function is not known in the compilation unit. In this case clang declares the method as void(void) and relies on the vtable caller casting the data back to the correct signature. Fixes: https://bugs.llvm.org/show_bug.cgi?id=40412 Differential Revision: https://reviews.llvm.org/D62153 llvm-svn: 361678
* [WebAssebmly] Add support for --wrapSam Clegg2019-05-241-1/+16
| | | | | | | | | | | The code for implementing this features is taken almost verbatim from the ELF backend. Fixes: https://bugs.llvm.org/show_bug.cgi?id=41681 Differential Revision: https://reviews.llvm.org/D62380 llvm-svn: 361639
* [lld] Trace all references with lld --trace-symbolSam Clegg2019-05-241-0/+6
| | | | | | | | | | | Previously undefined symbol references were only traced if they were seen before that definition. Fixes https://bugs.llvm.org/show_bug.cgi?id=41878 Differential Revision: https://reviews.llvm.org/D61929 llvm-svn: 361636
* Reland: [WebAssembly] Add __start_/_stop_ symbols for data sectionsSam Clegg2019-05-231-0/+11
| | | | | | | | | | This is a reland of rL361235. Fixes https://bugs.llvm.org/show_bug.cgi?id=41565 Differential Revision: https://reviews.llvm.org/D61876 llvm-svn: 361476
* Revert "[WebAssembly] Add __start_/_stop_ symbols for data sections"Sam Clegg2019-05-211-11/+0
| | | | | | | | | This reverts commit 7804dbddccba412087a15cab8db4412939700952. This change broke a bunch of tests of the WebAssembly waterfall. Will hopefully reland with increased test coverage. llvm-svn: 361273
* [WebAssembly] Add __start_/_stop_ symbols for data sectionsSam Clegg2019-05-211-0/+11
| | | | | | | | Fixes https://bugs.llvm.org/show_bug.cgi?id=41565 Differential Revision: https://reviews.llvm.org/D61876 llvm-svn: 361236
* [WebAssembly] LTO: Honor comdat groups when loading bitcode filesSam Clegg2019-05-151-2/+2
| | | | | | | | | But don't apply comdat groups when loading the LTO object files. This is basically the same logic used by the ELF linker. Differential Revision: https://reviews.llvm.org/D61924 llvm-svn: 360782
* [wasm] Simplify. NFCFangrui Song2019-04-181-1/+1
| | | | llvm-svn: 358663
* [WebAssembly] Ensure ArchiveName is set even in the presence of --whole-archive.Sam Clegg2019-04-091-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D60431 llvm-svn: 357966
* Make helper functions static. NFC.Benjamin Kramer2019-03-281-1/+2
| | | | llvm-svn: 357187
* [WebAssembly] Improve support for "needed" list in dylink sectionSam Clegg2019-03-131-0/+2
| | | | | | | | | | | This change adds basic support for shared library dependencies via the dylink section. See https://github.com/WebAssembly/tool-conventions/pull/77 Differential Revision: https://reviews.llvm.org/D59237 llvm-svn: 356102
* [WebAssembly] Don't mark lazy symbols as `IsUsedInRegularObj`Sam Clegg2019-03-081-4/+4
| | | | | | | | | | | This matches the ELF does. Update the comment in ELF/Symbols.h and duplicate it in wasm/Symbols.h This a followup on rL355580 and rL355577. Differential Revision: https://reviews.llvm.org/D59075 llvm-svn: 355737
* [WebAssembly] Remove redundant code added in rL354538. NFC.Sam Clegg2019-02-211-36/+4
| | | | | | | | | The code for encoding the symbols signature into its name was not actually being used in the final version of this change. Differential Revision: https://reviews.llvm.org/D58482 llvm-svn: 354539
* Fix unused variable warning.Richard Trieu2019-02-211-2/+2
| | | | llvm-svn: 354535
* [WebAssembly] Don't generate invalid modules when function signatures mismatchSam Clegg2019-02-201-55/+220
| | | | | | | | | | | | Previously we could emit a warning and generate a potentially invalid wasm module (due to call sites and functions having conflicting signatures). Now, rather than create invalid binaries we handle such cases by creating stub functions containing unreachable, effectively turning these into runtime errors rather than validation failures. Differential Revision: https://reviews.llvm.org/D57909 llvm-svn: 354528
* [WebAssembly] Refactor handling of weak undefined functions. NFC.Sam Clegg2019-02-071-1/+57
| | | | | | | | | | Also add to the docs. This is refactor in preparation for https://reviews.llvm.org/D57909 Differential Revision: https://reviews.llvm.org/D57920 llvm-svn: 353478
* [WebAssembly] Fix imported function symbol names that differ from their ↵Dan Gohman2019-02-071-4/+8
| | | | | | | | | | | | import names in the .o format Add a flag to allow symbols to have a wasm import name which differs from the linker symbol name, allowing the linker to link code using the import_module attribute. Differential Revision: https://reviews.llvm.org/D57632 llvm-svn: 353473
* [WebAssembly] Implement --trace and --trace-symbolSam Clegg2019-02-061-11/+40
| | | | | | Differential Revision: https://reviews.llvm.org/D57725 llvm-svn: 353264
* [WebAssembly] Support imports from custom module namesSam Clegg2019-02-011-3/+3
| | | | | | | | | | | | | Fixes: https://bugs.llvm.org/show_bug.cgi?id=37168 This is only a first pass at supporting these custom import modules. In the long run we most likely want to treat these kinds of symbols very differently. For example, it should not be possible to resolve such as symbol at static link type. Differential Revision: https://reviews.llvm.org/D45796 llvm-svn: 352828
* [WebAssembly] Don't load weak undefined symbols from archive filesSam Clegg2019-01-291-6/+24
| | | | | | | | | | 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-5/+48
| | | | | | | | | | | | | | | | | 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] Remove `using` statements from header files. NFC.Sam Clegg2018-11-271-0/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D54758 llvm-svn: 347621
* [WebAssembly] Fix inaccurate comments / assertion messagesHeejin Ahn2018-11-191-2/+2
| | | | | | | | | | Reviewers: sbc100 Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D54688 llvm-svn: 347273
* [WebAssembly] Preserve function signatures during LTOSam Clegg2018-09-281-4/+15
| | | | | | | | | | | | | | | | | | | With LTO when and undefined function (with a known signature) in replaced by a defined bitcode function we were loosing the signature information (since bitcode functions don't have signatures). With this change we preserve the original signature from the undefined function and verify that the post LTO compiled function has the correct signature. This change improves the error handling in the case where there is a signature mismatch with a function defined in a bitcode file. Differential Revision: https://reviews.llvm.org/D50721 llvm-svn: 343340
* [WebAssembly] Don't error when --undefined symbols are not foundSam Clegg2018-08-041-14/+1
| | | | | | | | | | | | | | | 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
* Set IsUsedInRegularObj in a consistent manor between COFF, ELF and wasm. NFCSam Clegg2018-08-021-37/+24
| | | | | | Differential Revision: https://reviews.llvm.org/D49147 llvm-svn: 338767
* [WebAssemlby] Set IsUsedInRegularObj correctly for undefined data symbolsSam Clegg2018-07-171-0/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D49113 llvm-svn: 337314
* [WebAssembly] LTO: Fix signatures of undefined functions in bitcodeSam Clegg2018-06-281-5/+13
| | | | | | | | | | | 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-20/+5
| | | | | | | | | | 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-5/+20
| | | | | | | | | | | | | 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] Update function signature mismatch error message. NFC.Sam Clegg2018-06-201-1/+1
| | | | | | | | | | We don't start our error messages with capital letters. Split out from https://reviews.llvm.org/D48394 Differential Revision: https://reviews.llvm.org/D48400 llvm-svn: 335186
* [WebAssembly] Initial support for LTOSam Clegg2018-05-301-6/+52
| | | | | | Differential Revision: https://reviews.llvm.org/D47162 llvm-svn: 333570
* [lld] Update uses of DEBUG macro to LLVM_DEBUG.Nicola Zaghen2018-05-151-15/+17
| | | | | | | | | | | 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] Allow signautre of entry function to be flexibleSam Clegg2018-05-141-4/+4
| | | | | | | | | 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] Update to match llvm changesSam Clegg2018-05-141-6/+6
| | | | | | | | Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D46849 llvm-svn: 332306
OpenPOWER on IntegriCloud