summaryrefslogtreecommitdiffstats
path: root/lld/test/wasm/lto
Commit message (Collapse)AuthorAgeFilesLines
* [lld][WebAssembly] Add libcall symbols to the link when LTO is being used.Sam Clegg2020-01-102-0/+31
| | | | | | | | | | | | | | | This code is copied almost verbatim from the equivalent change to the ELF linker: - https://reviews.llvm.org/D50017 - https://reviews.llvm.org/D50475 The upshot is that libraries containing libcall (such as compiler-rt and libc) can be compiled with LTO. Fixes PR41384 Differential Revision: https://reviews.llvm.org/D71738
* [lld][WebAssebmly] Preserve custom import attributes with LTOSam Clegg2019-10-171-0/+22
| | | | | | | | | | | | | | | | | | | 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
* Reland "Change the X86 datalayout to add three address spacesAmy Huang2019-09-101-1/+1
| | | | | | | | | | for 32 bit signed, 32 bit unsigned, and 64 bit pointers." This reverts 57076d3199fc2b0af4a3736b7749dd5462cacda5. Original review at https://reviews.llvm.org/D64931. Review for added fix at https://reviews.llvm.org/D66843. llvm-svn: 371568
* Revert "Change the X86 datalayout to add three address spaces for 32 bit ↵Vlad Tsyrklevich2019-08-281-1/+1
| | | | | | | | | signed," This reverts commit r370083 because it caused check-lld failures on sanitizer-x86_64-linux-fast. llvm-svn: 370142
* Change the X86 datalayout to add three address spaces for 32 bit signed,Amy Huang2019-08-271-1/+1
| | | | | | 32 bit unsigned, and 64 bit pointers. llvm-svn: 370083
* [WebAssembly] Improve lto/comdat.ll test. NFC.Sam Clegg2019-06-051-3/+5
| | | | | | | | | | | | | | | We were not previously testing the comdat exclusion in bitcode objects because we were linking two copies of the .bc file and the `linkonce_odr` linkage type was removing the duplicate `_start` at the LTO stage. Now we link an bitcode and non-bitcode version both of which contains a copy of _start. We link them in both orders, which means this test will fail if comdat exclusion is not working correctly in bitcode parsing. Differential Revision: https://reviews.llvm.org/D62923 llvm-svn: 362650
* [WebAssembly] Don't export __data_end and __heap_base by default.Sam Clegg2019-05-311-6/+0
| | | | | | | | 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-2/+18
| | | | | | | | | | | | | 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] LTO: Honor comdat groups when loading bitcode filesSam Clegg2019-05-151-0/+15
| | | | | | | | | 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
* [test] Change llvm-readobj -long-option to --long-option or well-known short ↵Fangrui Song2019-05-012-2/+2
| | | | | | | | | | | | options. NFC Also change some options that have different semantics (cause confusion) in llvm-readelf mode: -s => -S -t => --symbols -sd => --section-data llvm-svn: 359651
* [WebAssembly] LTO: Don't include bitcode-only symbols in the symtabSam Clegg2019-03-071-0/+27
| | | | | | | | Fixes https://bugs.llvm.org/show_bug.cgi?id=40654 Differential Revision: https://reviews.llvm.org/D59012 llvm-svn: 355577
* [WebAssebmly] Allow __wasm_call_ctors to be GC'edSam Clegg2019-03-014-10/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D58806 llvm-svn: 355240
* [WebAssembly] Remove uses of ThreadModelThomas Lively2019-02-281-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In the clang UI, replaces -mthread-model posix with -matomics as the source of truth on threading. In the backend, replaces -thread-model=posix with the atomics target feature, which is now collected on the WebAssemblyTargetMachine along with all other used features. These collected features will also be used to emit the target features section in the future. The default configuration for the backend is thread-model=posix and no atomics, which was previously an invalid configuration. This change makes the default valid because the thread model is ignored. A side effect of this change is that objects are never emitted with passive segments. It will instead be up to the linker to decide whether sections should be active or passive based on whether atomics are used in the final link. Reviewers: aheejin, sbc100, dschuff Subscribers: mehdi_amini, jgravelle-google, hiraditya, sunfish, steven_wu, dexonsmith, rupprecht, jfb, jdoerfert, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D58742 llvm-svn: 355112
* [WebAssembly] Don't generate invalid modules when function signatures mismatchSam Clegg2019-02-201-0/+1
| | | | | | | | | | | | 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] Update MC for bulk memoryThomas Lively2019-02-191-1/+1
| | | | | | | | | | | | | | | | | | Summary: Rename MemoryIndex to InitFlags and implement logic for determining data segment layout in ObjectYAML and MC. Also adds a "passive" flag for the .section assembler directive although this cannot be assembled yet because the assembler does not support data sections. Reviewers: sbc100, aardappel, aheejin, dschuff Subscribers: jgravelle-google, hiraditya, sunfish, rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D57938 llvm-svn: 354397
* [WebAssembly] Refactor handling of weak undefined functions. NFC.Sam Clegg2019-02-071-1/+1
| | | | | | | | | | 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] Update test expectations to match llvm-readobj change. NFC.Sam Clegg2019-02-071-1/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D57868 llvm-svn: 353358
* [WebAssembly] Use wasm-ld rather than lld with -flavor in tests. NFC.Sam Clegg2019-02-051-2/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D57758 llvm-svn: 353187
* [WebAssembly] Update test to match new readobj output. NFC.Sam Clegg2019-02-041-0/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D57715 llvm-svn: 353105
* [WebAssembly] Fix crash with LTO + relocatable + undefined symbolsSam Clegg2019-01-301-0/+36
| | | | | | | | | | | | Change the way we create the symbol table to be closer to how its done on ELF. Now the output symbol table matches the internal symtab order and includes local and undefined symbols. Fixes PR40204 Differential Revision: https://reviews.llvm.org/D56947 llvm-svn: 352645
* [WebAssembly] Fix undefined weak function symbols in LTO buildsSam Clegg2019-01-301-0/+20
| | | | | | | | | | Summary: Fixes PR40219 Subscribers: dschuff, mehdi_amini, inglorion, jgravelle-google, aheejin, sunfish, steven_wu, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D57420 llvm-svn: 352575
* [test] Mark atime-based tests unsupported on NetBSDMichal Gorny2018-12-071-0/+2
| | | | | | | Mark tests requiring 'touch' to set atime unsupported on NetBSD due to kernel limitation preventing it from working with noatime. llvm-svn: 348607
* Reland "Change the timestamp of llvmcache-foo file to meet the thinLTO ↵Fangrui Song2018-11-021-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | prune policy" Summary: It is difficult to touch a file with a relative mtime across different OSes as POSIX touch -d is rigid. While we may construct relative timestamps with `date`, POSIX date is inadequate to do so as various OSes' date do not agree on a common format (OpenBSD uses `date -r seconds`, FreeBSD uses `date -v-2M` while GNU accepts `-d '-2 min'`) Just use python os.utime() Original description: The case may randomly fail if we test it with command " while llvm-lit tools/lld/test/ELF/lto/cache.ll; do true; done". It is because the llvmcache-foo file is younger than llvmcache-349F039B8EB076D412007D82778442BED3148C4E and llvmcache-A8107945C65C2B2BBEE8E61AA604C311D60D58D6. But due to timestamp precision reason their timestamp is the same. Given the same timestamp, the file prune policy is to remove bigger size file first, so mostly foo file is removed for its bigger size. And the files size is under threshold after deleting foo file. That's what test case expect. However sometimes, the precision is enough to measure that timestamp of llvmcache-349F039B8EB076D412007D82778442BED3148C4E and llvmcache-A8107945C65C2B2BBEE8E61AA604C311D60D58D6 are smaller than foo, so llvmcache-349F039B8EB076D412007D82778442BED3148C4E and llvmcache-A8107945C65C2B2BBEE8E61AA604C311D60D58D6 are deleted first. Since the files size is still above the file size threshold after deleting the 2 files, the foo file is also deleted. And then the test case fails, because it expect only one file should be deleted instead of 3. The fix is to change the timestamp of llvmcache-foo file to meet the thinLTO prune policy. The same fix is applied to llvm code at https://reviews.llvm.org/D52452. Patch by Luo Yuanke. Reviewers: ruiu, craig.topper, smaslov, Jianping, espindola, LuoYuanke, tejohnson Reviewed By: tejohnson Subscribers: sbc100, krytarowski, aheejin, llvm-commits, dexonsmith, steven_wu, arichardson, inglorion, emaste, bjope, rupprecht Differential Revision: https://reviews.llvm.org/D54039 llvm-svn: 346006
* Revert "Change the timestamp of llvmcache-foo file to meet the thinLTO ↵Teresa Johnson2018-11-021-4/+0
| | | | | | | | | | | | | | | prune policy" This reverts commit r345977. A few bots failing because the invocation of "touch" is not accepted on a couple other OSes. Specifically the -d argument is not accepted or requires a different format. http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/27103/steps/test_lld/logs/stdio http://lab.llvm.org:8011/builders/lld-x86_64-freebsd/builds/24974/steps/test_lld/logs/stdio llvm-svn: 345980
* Change the timestamp of llvmcache-foo file to meet the thinLTO prune policyTeresa Johnson2018-11-021-0/+4
| | | | | | | | | | | | | | | | | | | | | | Summary: The case may randomly fail if we test it with command " while llvm-lit tools/lld/test/ELF/lto/cache.ll; do true; done". It is because the llvmcache-foo file is younger than llvmcache-349F039B8EB076D412007D82778442BED3148C4E and llvmcache-A8107945C65C2B2BBEE8E61AA604C311D60D58D6. But due to timestamp precision reason their timestamp is the same. Given the same timestamp, the file prune policy is to remove bigger size file first, so mostly foo file is removed for its bigger size. And the files size is under threshold after deleting foo file. That's what test case expect. However sometimes, the precision is enough to measure that timestamp of llvmcache-349F039B8EB076D412007D82778442BED3148C4E and llvmcache-A8107945C65C2B2BBEE8E61AA604C311D60D58D6 are smaller than foo, so llvmcache-349F039B8EB076D412007D82778442BED3148C4E and llvmcache-A8107945C65C2B2BBEE8E61AA604C311D60D58D6 are deleted first. Since the files size is still above the file size threshold after deleting the 2 files, the foo file is also deleted. And then the test case fails, because it expect only one file should be deleted instead of 3. The fix is to change the timestamp of llvmcache-foo file to meet the thinLTO prune policy. The same fix is applied to llvm code at https://reviews.llvm.org/D52452. Patch by Luo Yuanke. Reviewers: ruiu, craig.topper, smaslov, Jianping, espindola, LuoYuanke Subscribers: rupprecht, bjope, emaste, inglorion, arichardson, steven_wu, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D53123 llvm-svn: 345977
* [WebAssembly] Remove duplicate function. NFC.Sam Clegg2018-11-011-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D53963 llvm-svn: 345806
* [WebAssembly] Preserve function signatures during LTOSam Clegg2018-09-281-0/+19
| | | | | | | | | | | | | | | | | | | 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] Add --[no]-export-dynamic to replace --export-defaultSam Clegg2018-09-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | In a very recent change I introduced a --no-export-default flag but after conferring with others it seems that this feature already exists in gnu GNU ld and lld in the form the --export-dynamic flag which is off by default. This change replaces export-default with export-dynamic and also changes the default to match the traditional linker behaviour. Now, by default, only the entry point is exported. If other symbols are required by the embedder then --export-dynamic or --export can be used to export all visibility hidden symbols or individual symbols respectively. This change touches a lot of tests that were relying on symbols being exported by default. I imagine it will also effect many users but do think the change is worth it match of the traditional behaviour and flag names. Differential Revision: https://reviews.llvm.org/D52587 llvm-svn: 343265
* [lit, python] Always add quotes around the python path in litStella Stamenova2018-08-061-1/+1
| | | | | | | | | | | | | | | Summary: The issue with the python path is that the path to python on Windows can contain spaces. To make the tests always work, the path to python needs to be surrounded by quotes. This is a companion change to: https://reviews.llvm.org/D50206 Reviewers: asmith, zturner, espindola Subscribers: emaste, sbc100, arichardson, aheejin, steven_wu, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D50282 llvm-svn: 339075
* [WebAssembly] Don't error when --undefined symbols are not foundSam Clegg2018-08-041-3/+3
| | | | | | | | | | | | | | | 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
* [WebAssemlby] Set IsUsedInRegularObj correctly for undefined data symbolsSam Clegg2018-07-172-0/+53
| | | | | | Differential Revision: https://reviews.llvm.org/D49113 llvm-svn: 337314
* [LTO] Errors in LLVM backend should manifest as lld errorsSam Clegg2018-07-021-0/+22
| | | | | | Differential Revision: https://reviews.llvm.org/D48812 llvm-svn: 336143
* [WebAssembly] Set threadmodel during LTOSam Clegg2018-07-021-0/+14
| | | | | | | | Subscribers: dschuff, mehdi_amini, inglorion, jgravelle-google, aheejin, sunfish, steven_wu, llvm-commits Differential Revision: https://reviews.llvm.org/D48689 llvm-svn: 336118
* [WebAssembly] Fix --export of LTO symbolsSam Clegg2018-06-281-0/+38
| | | | | | Differential Revision: https://reviews.llvm.org/D48697 llvm-svn: 335881
* [WebAssembly] Add support for bitcode archive membersSam Clegg2018-06-282-0/+31
| | | | | | | | | | This change effects the behavior of --export-all. Previously --export-all would only effect symbols that survived GC. Now --export-all will prevent any non-local symbols from being GCed. Differential Revision: https://reviews.llvm.org/D48673 llvm-svn: 335878
* [WebAssembly] LTO: Fix signatures of undefined functions in bitcodeSam Clegg2018-06-281-0/+20
| | | | | | | | | | | 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
* [WebAssembly] Initial support for LTOSam Clegg2018-05-3013-0/+246
Differential Revision: https://reviews.llvm.org/D47162 llvm-svn: 333570
OpenPOWER on IntegriCloud