summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/gold
Commit message (Collapse)AuthorAgeFilesLines
* Infer relocation model from module flags in relocatable LTO link.Evgeniy Stepanov2017-05-221-0/+63
| | | | | | Fix for PR33096. llvm-svn: 303578
* LTO: Mark undefined module asm symbols as used.Peter Collingbourne2017-04-261-2/+2
| | | | | | | | | | | | | | | | Marking them as used causes them to be considered visible outside of LTO. This prevents the symbols from being internalized or discarded, either by GlobalDCE or by summary-based dead stripping in ThinLTO. This change makes it unnecessary to add these symbols to llvm.compiler.used in the backend, as the symbols are kept alive by virtue of being external, so remove the backend code that handles that. Fixes PR32798. Differential Revision: https://reviews.llvm.org/D32544 llvm-svn: 301438
* Bitcode: Add a string table to the bitcode format.Peter Collingbourne2017-04-171-17/+5
| | | | | | | | | | | | | | | | | | | | | | | Add a top-level STRTAB block containing a string table blob, and start storing strings for module codes FUNCTION, GLOBALVAR, ALIAS, IFUNC and COMDAT in the string table. This change allows us to share names between globals and comdats as well as between modules, and improves the efficiency of loading bitcode files by no longer using a bit encoding for symbol names. Once we start writing the irsymtab to the bitcode file we will also be able to share strings between it and the module. On my machine, link time for Chromium for Linux with ThinLTO decreases by about 7% for no-op incremental builds or about 1% for full builds. Total bitcode file size decreases by about 3%. As discussed on llvm-dev: http://lists.llvm.org/pipermail/llvm-dev/2017-April/111732.html Differential Revision: https://reviews.llvm.org/D31838 llvm-svn: 300464
* [ThinLTO] Add support for emitting minimized bitcode for thin linkTeresa Johnson2017-03-231-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The cumulative size of the bitcode files for a very large application can be huge, particularly with -g. In a distributed build environment, all of these files must be sent to the remote build node that performs the thin link step, and this can exceed size limits. The thin link actually only needs the summary along with a bitcode symbol table. Until we have a proper bitcode symbol table, simply stripping the debug metadata results in significant size reduction. Add support for an option to additionally emit minimized bitcode modules, just for use in the thin link step, which for now just strips all debug metadata. I plan to add a cc1 option so this can be invoked easily during the compile step. However, care must be taken to ensure that these minimized thin link bitcode files produce the same index as with the original bitcode files, as these original bitcode files will be used in the backends. Specifically: 1) The module hash used for caching is typically produced by hashing the written bitcode, and we want to include the hash that would correspond to the original bitcode file. This is because we want to ensure that changes in the stripped portions affect caching. Added plumbing to emit the same module hash in the minimized thin link bitcode file. 2) The module paths in the index are constructed from the module ID of each thin linked bitcode, and typically is automatically generated from the input file path. This is the path used for finding the modules to import from, and obviously we need this to point to the original bitcode files. Added gold-plugin support to take a suffix replacement during the thin link that is used to override the identifier on the MemoryBufferRef constructed from the loaded thin link bitcode file. The assumption is that the build system can specify that the minimized bitcode file has a name that is similar but uses a different suffix (e.g. out.thinlink.bc instead of out.o). Added various tests to ensure that we get identical index files out of the thin link step. Reviewers: mehdi_amini, pcc Subscribers: Prazek, llvm-commits Differential Revision: https://reviews.llvm.org/D31027 llvm-svn: 298638
* LTO: When creating a local cache, create the cache directory if it does not ↵Peter Collingbourne2017-03-021-2/+2
| | | | | | | | already exist. Differential Revision: https://reviews.llvm.org/D30519 llvm-svn: 296726
* [ThinLTO] PrintStatistics when we exit early for thinlto-index-onlyTeresa Johnson2017-02-021-0/+7
| | | | | | | | | | | | | | Summary: This is necessary to get stats from the ThinLink printed before the early exit when compiling in a distributed build. Reviewers: mehdi_amini Subscribers: Prazek, llvm-commits Differential Revision: https://reviews.llvm.org/D29461 llvm-svn: 293908
* gold-plugin: Fix test case.Peter Collingbourne2017-01-261-1/+2
| | | | llvm-svn: 293137
* gold-plugin: Simplify naming of object files created with save-temps or ↵Peter Collingbourne2017-01-261-2/+2
| | | | | | | | | | obj-path. Now we never append a number to the file name for task ID 0. Differential Revision: https://reviews.llvm.org/D29160 llvm-svn: 293132
* gold-plugin: Add the file path to the file open error diagnostic.Peter Collingbourne2017-01-251-0/+8
| | | | llvm-svn: 293013
* [ThinLTO] Drop non-prevailing non-ODR weak to declarationsTeresa Johnson2017-01-204-10/+84
| | | | | | | | | | | | | | | Summary: Allow non-ODR weak/linkonce non-prevailing copies to be marked as available_externally in the index. Add support for dropping these to declarations in the backend. Reviewers: mehdi_amini, pcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D28806 llvm-svn: 292656
* Fix x86 gold tests on non-x86 targets.Asiri Rathnayake2017-01-0413-0/+31
| | | | | | | | | | These tests are missing a target triple and the -m elf_x86_64 gold option, which makes them fail on non-x86 targets. Differential revision: https://reviews.llvm.org/D28285 Reviewers: tejohnson llvm-svn: 290965
* Pass sample pgo flags to thinlto.Dehao Chen2016-12-162-0/+27
| | | | | | | | | | | | Summary: ThinLTO needs to invoke SampleProfileLoader pass during link time in order to annotate profile correctly after module importing. Reviewers: davidxl, mehdi_amini, tejohnson Subscribers: pcc, davide, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D27790 llvm-svn: 289957
* [gold] Add datalayout to test where it was missingTeresa Johnson2016-12-152-0/+6
| | | | | | | | | Needed due to change to require datalayout (r289719). Found this in my own testing, maybe there aren't any bots using a v1.12 gold yet. llvm-svn: 289876
* [gold] Add datalayout to two tests where it was missing.Davide Italiano2016-12-142-0/+6
| | | | | | Reported by: thakis via chromium bots. llvm-svn: 289737
* [LTO] Reject modules without datalayout.Davide Italiano2016-12-1472-1/+121
| | | | | | | | | | | Also, udpate the ~60 failing tests in the tree which did not contain a valid datalayout. This fixes PR31123. lld will be updated in a following patch, immediately after this is committed. Differential Revision: https://reviews.llvm.org/D27082 llvm-svn: 289719
* Fix test/tools/gold/X86/thinlto_funcimport.ll on non-X86 hostsJohn Brawn2016-11-111-2/+2
| | | | | | Pass -m elf_x86_64 to gold, as is done in other tests. llvm-svn: 286593
* [ThinLTO] Disable importing and other cross-module optis at -O0Teresa Johnson2016-10-312-0/+38
| | | | | | | | | | | | | | | | Summary: There is no point to importing at -O0, since we won't inline. We should also disable other cross-module optimizations. (Plan to backport this fix to the 3.9 branch to fix PR30774) Reviewers: pcc Subscribers: johanengelen, mehdi_amini Differential Revision: https://reviews.llvm.org/D25918 llvm-svn: 285648
* [ThinLTO] Correctly resolve linkonce when importing aliaseeTeresa Johnson2016-10-301-14/+29
| | | | | | | | | | | | | | | | | | | Summary: When we have an aliasee that is linkonce, while we can't convert the non-prevailing copies to available_externally, we still need to convert the prevailing copy to weak. If a reference to the aliasee is exported, not converting a copy to weak will result in undefined references when the linkonce is removed in its original module. Add a new test and update existing tests. Reviewers: mehdi_amini Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D26076 llvm-svn: 285512
* Fix test on non-x86 hostsBernard Ogden2016-10-111-1/+1
| | | | | | | | | | Summary: This test is allowed to run on non-x86 hosts and thus must use llvm-nm rather than nm. Differential Revision: https://reviews.llvm.org/D25473 llvm-svn: 283901
* ThinLTO: Fix Gold test after caching fix in r283655Mehdi Amini2016-10-081-1/+15
| | | | | | (I don't have Gold available, so this is speculative) llvm-svn: 283681
* [gold] Split plugin options controlling ThinLTO and codegen parallelism.Teresa Johnson2016-09-231-1/+1
| | | | | | | | | | | | | | | | Summary: As suggested in D24826, use different options for ThinLTO backend parallelism from the option controlling regular LTO code gen parallelism. They are already split in the LTO API, and this enables controlling them with different clang options. Reviewers: pcc, mehdi_amini Subscribers: dexonsmith, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D24873 llvm-svn: 282290
* [ThinLTO] Emit files for distributed builds for all modulesTeresa Johnson2016-09-211-0/+12
| | | | | | | | | | | | | | | | | | | | With the new LTO API in r278338, we stopped emitting the individual index files and imports files for some modules in the distributed backend case (thinlto-index-only plugin option). Specifically, this is when the linker decides not to include a module in the link, because it was in an archive library and did not have a strong reference to it. Not creating the expected output files makes the distributed build system implementation more difficult, in terms of checking for the expected outputs of the thin link, and scheduling the backend jobs. To address this, the gold-plugin will write dummy empty .thinlto.bc and .imports files for modules not included in the link (which LTO never sees). Augmented a gold v1.12+ test, since that version of gold has the handling for notifying on modules not being included in the link. llvm-svn: 282100
* [ThinLTO] Always emit a summary when compiling in ThinLTO modeTeresa Johnson2016-09-202-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Emit an empty summary section, instead of no summary section, when there are no global variables in the index. This ensures that LTO will treat these files as ThinLTO inputs, instead of as regular LTO inputs. In addition to not being what the user likely intended when compiling with -flto=thin, the current behavior is problematic for distributed build systems that expect to get ThinLTO index and imports files back for each input compiled with -flto=thin. Combining into a single regular LTO module also reduces the backend parallelism. And in the case where the index was suppressed due to uses in inline assembly, combining into a single LTO module could provoke renaming of duplicates that we were trying to prevent by suppressing the index. This change required a couple of fixes to handle the empty summary section. Reviewers: mehdi_amini Subscribers: mehdi_amini, llvm-commits, pcc Differential Revision: https://reviews.llvm.org/D24779 llvm-svn: 282037
* [LTO] Use llvm-nm instead of nm in new testsTeresa Johnson2016-09-161-1/+1
| | | | | | | | | | | The use of nm in the new tests added with r281725 caused a couple of bot failures: http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/15701 http://bb.pgr.jp/builders/ninja-clang-i686-msc19-R/builds/6939 Use llvm-nm instead. llvm-svn: 281750
* [LTO] Prevent asm references to be dropped from the output.Davide Italiano2016-09-161-0/+28
| | | | | | Differential Revision: https://reviews.llvm.org/D24617 llvm-svn: 281741
* [LTO] Fix handling of mixed (regular and thin) mode LTOTeresa Johnson2016-09-162-0/+24
| | | | | | | | | | | | | | | | | | | | | Summary: In runThinLTO we start the task numbering for ThinLTO backend tasks depending on whether there was also a regular LTO object (CombinedModule). However, the CombinedModule is moved at the end of runRegularLTO, so we need to save this information and pass it into runThinLTO. Otherwise the AddOutput callback to the client will use the same task number for both the regular LTO object and the first ThinLTO object, which in gold-plugin caused only one to be end up in the output filename array and therefore passed back to gold for the final native link. Reviewers: pcc, mehdi_amini Subscribers: mehdi_amini, kromanova Differential Revision: https://reviews.llvm.org/D24643 llvm-svn: 281725
* [LTO] Don't pass SF_Undefined symbols to the IRmover.Davide Italiano2016-09-131-0/+18
| | | | | | This should fix PR 30363. llvm-svn: 281366
* [gold/LTO] Add test case for r281134Teresa Johnson2016-09-101-0/+10
| | | | | | Add test case that was supposed to go in with r281134. llvm-svn: 281135
* [gold] Test that we handle invalid directory correctly.Davide Italiano2016-09-092-0/+9
| | | | | | | | | I had this test sitting around for a while but always forgot to commit. Rafael reviewed it a while ago. Differential Revision: https://reviews.llvm.org/D19207 llvm-svn: 281109
* [gold] Fix test accidentally regressed for newer goldTeresa Johnson2016-08-293-1/+18
| | | | | | | | | | | | With r279911 I accidentally regressed the gold/X86/start-lib-common.ll test for newer golds (v1.12+) that honor the --start-lib/--end-lib. Remove the alignment which should not be there to make this work with both old and new gold linkers. Additionally, now that we have a subdirectory for v1.12+ gold tests, copy this test there and check specifically for the v1.12+ behavior. llvm-svn: 279977
* [LTO] Don't create a new common unless merged has different sizeTeresa Johnson2016-08-272-4/+4
| | | | | | | | | | | | | | | | | Summary: This addresses a regression in common handling from the new LTO API in r278338. Only create a new common if the size is different. The type comparison against an array type fails when the size is different but not an array. GlobalMerge does not handle the array types as well and we lose some global merging opportunities. Reviewers: mehdi_amini Subscribers: junbuml, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D23955 llvm-svn: 279911
* [ThinLTO/gold] Add caching support to gold-pluginTeresa Johnson2016-08-242-0/+27
| | | | | | | | | | | | | | Summary: With support now in the new LTO API for caching (r279576), add optional ThinLTO caching in the gold-plugin. Reviewers: mehdi_amini Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D23836 llvm-svn: 279631
* Tentatively fix gold-plugin test: ThinLTO objects start at offset 0 now.Mehdi Amini2016-08-241-1/+1
| | | | | | Annoyingly, incremental builds don't detect these kind of issue. llvm-svn: 279612
* [gold/ThinLTO] Restore ThinLTO file management in gold pluginTeresa Johnson2016-08-201-0/+10
| | | | | | | | | | | | | | | | | | Summary: The gold-plugin changes added along with the new LTO API in r278338 had the effect of removing the management of the PluginInputFile that ensured the files weren't released back to gold until the backend threads were complete. Add back the old file handling. Fixes PR29020. Reviewers: mehdi_amini Subscribers: mehdi_amini, llvm-commits, hjl.tools Differential Revision: https://reviews.llvm.org/D23721 llvm-svn: 279356
* [gold] Fix new gold test to specify emulation modeTeresa Johnson2016-08-201-0/+1
| | | | | | Add emulation mode option for new test added in r279023. llvm-svn: 279355
* Fix tests in llvm/test/tools/gold/X86 to satisfy r279014.NAKAMURA Takumi2016-08-197-9/+9
| | | | | | They would unexpectedly pass if test/tools/gold/X86/Output had outputs of previous tests. llvm-svn: 279214
* Fix bot failure due to new testTeresa Johnson2016-08-181-1/+1
| | | | | | | I had updated the output file name but not the corresponding nm based check before submitting as r279023. This should fix the bot failures llvm-svn: 279025
* [ThinLTO] Keep common symbols in ThinLTO modulesTeresa Johnson2016-08-182-0/+51
| | | | | | | | | | | | | | | | | | | | Summary: Skip the merging of common symbols for ThinLTO modules, they will be merged by the final native object link. Trying to merge the symbols and add to a combined module will incorrectly enable the common symbol to be internalized in the ThinLTO module. Additionally, we will not want to create a combined module for ThinLTO distributed builds. This fixes failures in 7 cpu2006 benchmarks from the new LTO API in ThinLTO mode. Reviewers: mehdi_amini Subscribers: pcc, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D23637 llvm-svn: 279023
* [LTO] Change addSaveTemps API: do not add dot to the supplied prefix pathMehdi Amini2016-08-181-3/+3
| | | | | | | | | | | | | | | | Summary: It does not play well with directories (end up with a bunch of hidden files). Also, do not strip the 0 suffix for the first task, especially since 0 can be used by ThinLTO as well now. Reviewers: tejohnson Subscribers: mehdi_amini, pcc, llvm-commits Differential Revision: https://reviews.llvm.org/D23612 llvm-svn: 279014
* Restore "Resolution-based LTO API."Teresa Johnson2016-08-1117-97/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This restores commit r278330, with fixes for a few bot failures: - Fix a late change I had made to the save temps output file that I missed due to existing files sitting on my disk - Fix a bunch of Windows bot failures with "ambiguous call to overloaded function" due to confusion between llvm::make_unique vs std::make_unique (preface the new make_unique calls with "llvm::") - Attempt to fix a modules bot failure by adding a missing include to LTO/Config.h. Original change: Resolution-based LTO API. Summary: This introduces a resolution-based LTO API. The main advantage of this API over existing APIs is that it allows the linker to supply a resolution for each symbol in each object, rather than the combined object as a whole. This will become increasingly important for use cases such as ThinLTO which require us to process symbol resolutions in a more complicated way than just adjusting linkage. Patch by Peter Collingbourne. Reviewers: rafael, tejohnson, mehdi_amini Subscribers: lhames, tejohnson, mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D20268 llvm-svn: 278338
* Revert "Resolution-based LTO API."Teresa Johnson2016-08-1117-112/+97
| | | | | | | | | | This reverts commit r278330. I made a change to the save temps output that is causing issues with the bots. Didn't realize this because I had older output files sitting on disk in my test output directory. llvm-svn: 278331
* Resolution-based LTO API.Teresa Johnson2016-08-1117-97/+112
| | | | | | | | | | | | | | | | | | | | | | Summary: This introduces a resolution-based LTO API. The main advantage of this API over existing APIs is that it allows the linker to supply a resolution for each symbol in each object, rather than the combined object as a whole. This will become increasingly important for use cases such as ThinLTO which require us to process symbol resolutions in a more complicated way than just adjusting linkage. Patch by Peter Collingbourne. Reviewers: rafael, tejohnson, mehdi_amini Subscribers: lhames, tejohnson, mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D20268 Address review comments llvm-svn: 278330
* Capture stderr when checking for gold versionTeresa Johnson2016-07-291-3/+5
| | | | | | | On MacOS the ld version is emitted to stderr, resulting in lots of messages in the ninja check output. llvm-svn: 277092
* [test/gold] Add gold test subdirectory tests needing v1.12 (or higher)Teresa Johnson2016-07-273-0/+63
| | | | | | | | | | | | | | | | Summary: As discussed in the review for D22677, added a subdirectory to enable tests that require at least version 1.12 of gold. Add an initial test requiring this version. Reviewers: davidxl, mehdi_amini Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D22827 llvm-svn: 276860
* [ThinLTO/gold] Remove thin archive part of new test due to bot failuresTeresa Johnson2016-07-221-12/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | I am getting a bot failure from the thin archive part of this test: From http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/40468/steps/test_llvm/logs/LLVM%20%3A%3A%20tools__gold__X86__thinlto_emit_linked_objects.ll: Command Output (stderr): -- /home/bb/cmake-llvm-x86_64-linux/build/./bin/llvm-ar: creating /home/bb/cmake-llvm-x86_64-linux/build/test/tools/gold/X86/Output/thinlto_emit_linked_objects.ll.tmp2.a /usr/bin/ld.gold: internal error in add_writer, at ../../gold/token.h:124 -- This appears to be an issue with an older version of gold. The test case passes for me locally when I use the gold v1.12 I was testing with, but when I tried the gold installed on my system which is v1.11 I get the same error. Remove the thin archive version of the test, since there isn't a way to predicate it on gold version. llvm-svn: 276453
* [ThinLTO/gold] Support for getting list of included objects from goldTeresa Johnson2016-07-222-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In the distributed backend case, the ThinLink step and the final native object link are separate processes. This can be problematic when archive libraries are involved in the link (e.g. via --start-lib/--end-lib pairs). The linker only includes objects from libraries when there is a strong reference to them, and depending on the intervening ThinLTO backend processes' importing/inlining, the strong references may appear different in the two link steps. See D22356 and D22467 for two scenarios where this causes issues. To ensure that the final link includes the same objects, this patch adds support for an "=filename" form of the thinlto-index-only plugin option, in which case objects gold included in the link are emitted to the given filename. This should be used as input to the final link (e.g. via the @filename option to gold), instead of listing all the objects within --start-lib/--end-lib pairs again. Note that the support for the gold callback that identifies included objects was added in gold version 1.12. Reviewers: davidxl, mehdi_amini Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D22677 llvm-svn: 276450
* [ThinLTO/gold] Perform index-based weak/linkonce resolutionTeresa Johnson2016-07-142-0/+124
| | | | | | | | | | | | | | | | | | | | Summary: Invoke the weak/linkonce symbol resolution support (already used by libLTO) that operates via the summary index. This ensures prevailing linkonce are kept, by making them weak, and marks preempted copies as available_externally when possible. With this change, the older support for keeping the prevailing linkonce (by changing their symbol resolution) is removed. Reviewers: mehdi_amini Subscribers: llvm-commits, mehdi_amini Differential Revision: http://reviews.llvm.org/D22302 llvm-svn: 275474
* [ThinLTO/gold] Enable symbol resolution in distributed backend caseTeresa Johnson2016-07-131-2/+0
| | | | | | | | | | | | | | | | While testing a follow-on change to enable index-based symbol resolution and internalization in the distributed backends, I realized that a test case change I made in r275247 was only required because we were not analyzing symbols in the claimed files in thinlto-index-only mode. In the fixed test case there should be no internalization because we are linking in -shared mode, so f() is in fact exported, which is detected properly when we analyze symbols in thinlto-index-only mode. Note that this is not (yet) a correctness issue (because we are not yet performing the index-based linkage optimizations in the distributed backends - that's coming in a follow-on patch). llvm-svn: 275277
* [ThinLTO/gold] ThinLTO internalization fixesTeresa Johnson2016-07-132-0/+9
| | | | | | | | | | | Internalization was missing cases where we originally had a local symbol that was promoted eagerly but not actually exported. This is because we were only internalizing the set of global (non-local) symbols that were PREVAILAING_DEF_IRONLY. Instead, collect the set of global symbols that are referenced outside of a single IR file, and skip internalization for those. llvm-svn: 275247
* [gold] Really fix test to run on non x86 platforms.Arnaud A. de Grandmaison2016-06-281-1/+1
| | | | | | Address post-commit comment from H.J. Lu. llvm-svn: 274000
OpenPOWER on IntegriCloud