summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-link
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove "ExportingModule" from ThinLTO Index (NFC)Mehdi Amini2015-12-031-1/+1
| | | | | | | | | | | | | | | | | | | | | There is no real reason the index has to have the concept of an exporting Module. We should be able to have one single unique instance of the Index, and it should be read-only after creation for the whole ThinLTO processing. The linker plugin should be able to process multiple modules (in parallel or in sequence) with the same index. The only reason the ExportingModule was present seems to be to implement hasExportedFunctions() that is used by the Module linker to decide what to do with the current Module. For now I replaced it with a query to the map of Modules path to see if this module was declared in the Index and consider that if it is the case then it is probably exporting function. On the long term the Linker interface needs to evolve and this call should not be needed anymore. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 254581
* Change ModuleLinker to take a set of GlobalValues to import instead of a ↵Mehdi Amini2015-12-021-1/+4
| | | | | | | | | | | | single one For efficiency reason, when importing multiple functions for the same Module, we can avoid reparsing it every time. Differential Revision: http://reviews.llvm.org/D15102 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 254486
* Use references now that it is natural to do so.Rafael Espindola2015-12-011-3/+3
| | | | | | | The linker never takes ownership of a module or changes which module it is refering to, making it natural to use references. llvm-svn: 254449
* [ThinLTO] Deduplicate function index loading into shared helper (NFC)Teresa Johnson2015-11-231-23/+4
| | | | | | | | Add a shared helper routine to read the function index from a file and create/return the function index object. Use it in llvm-link and llvm-lto. llvm-svn: 253903
* Remove unused function parameter (NFC)Teresa Johnson2015-11-231-5/+3
| | | | llvm-svn: 253889
* llvm-link option and test for recent metadata mapping bugTeresa Johnson2015-11-211-0/+13
| | | | | | | | | | | | | | | | | | | | | | | Summary: Add a -preserve-modules option to llvm-link that simulates LTO clients that don't destroy modules as they are linked. This enables reproduction of a recent bug introduced by a metadata linking change that was only caught when the modules weren't destroyed before writing bitcode (LTO on Windows). See http://llvm.org/viewvc/llvm-project?view=revision&revision=253170 for more details on the original bug and the fix. Confirmed the new test added here reproduces the failure using the new option when I suppress the fix. Reviewers: pcc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D14818 llvm-svn: 253740
* Do not require a Context to extract the FunctionIndex from Bitcode (NFC)Mehdi Amini2015-11-191-1/+1
| | | | | | | | | | The LLVMContext was only used for Diagnostic. Pass a DiagnosticHandler instead. Differential Revision: http://reviews.llvm.org/D14794 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 253540
* Pass enum instead of bool to new linkInModule call in llvm-linkTeresa Johnson2015-11-031-1/+1
| | | | | | | | | A new call I added to linkInModule from llvm-link in r251866 was still passing in a boolean for an argument that was changed to an enum in r246561. I didn't catch this in my merge since the bool false matched the flag value it mapped to. llvm-svn: 251925
* Restore "Support for ThinLTO function importing and symbol linking."Teresa Johnson2015-11-034-3/+125
| | | | | | | This restores commit r251837, with the new library dependence added to llvm-link/Makefile to address bot failures. llvm-svn: 251866
* Revert "Support for ThinLTO function importing and symbol linking."Teresa Johnson2015-11-023-124/+2
| | | | | | | | | | | | | | | | | | | | This reverts commit r251837, due to a number of bot failures of the form: /home/grosser/buildslave/perf-x86_64-penryn-O3-polly-fast/llvm.obj/tools/llvm-link/Release+Asserts/llvm-link.o:llvm-link.cpp:function loadIndex(llvm::LLVMContext&, llvm::Module const*): error: undefined reference to 'llvm::object::FunctionIndexObjectFile::create(llvm::MemoryBufferRef, llvm::LLVMContext&, llvm::Module const*, bool)' /home/grosser/buildslave/perf-x86_64-penryn-O3-polly-fast/llvm.obj/tools/llvm-link/Release+Asserts/llvm-link.o:llvm-link.cpp:function loadIndex(llvm::LLVMContext&, llvm::Module const*): error: undefined reference to 'llvm::object::FunctionIndexObjectFile::takeIndex()' I'm not sure why these are happening - I added Object to the requred libraries in tools/llvm-link/LLVMBuild.txt and the LLVM_LINK_COMPONENTS in tools/llvm-link/CMakeLists.txt. Confirmed for my build that these symbols come out of libLLVMObject.a. What am I missing? llvm-svn: 251841
* Support for ThinLTO function importing and symbol linking.Teresa Johnson2015-11-023-2/+124
| | | | | | | | | | | | | | | | | | | | | Summary: Support for necessary linkage changes and symbol renaming during ThinLTO function importing. Also includes llvm-link support for manually importing functions and associated llvm-link based tests. Note that this does not include support for intelligently importing metadata, which is currently imported duplicate times. That support will be in the follow-on patch, and currently is ignored by the tests. Reviewers: dexonsmith, joker.eph, davidxl Subscribers: tobiasvk, tejohnson, llvm-commits Differential Revision: http://reviews.llvm.org/D13515 llvm-svn: 251837
* New bitcode linker flags:Artem Belevich2015-09-011-4/+21
| | | | | | | | | -only-needed -- link in only symbols needed by destination module -internalize -- internalize linked symbols Differential Revision: http://reviews.llvm.org/D12459 llvm-svn: 246561
* Linker: Add flag to override linkage rulesDuncan P. N. Exon Smith2015-04-221-3/+14
| | | | | | | | | | | | | | | | Add a flag to lib/Linker (and `llvm-link`) to override linkage rules. When set, the functions in the source module *always* replace those in the destination module. The `llvm-link` option is `-override=abc.ll`. All the "regular" modules are loaded and linked first, followed by the `-override` modules. This is useful for debugging workflows where some subset of the module (e.g., a single function) is extracted into a separate file where it's optimized differently, before being merged back in. Patch by Luqman Aden! llvm-svn: 235473
* llvm-link: Factor out loop over input files, NFCDuncan P. N. Exon Smith2015-04-221-18/+26
| | | | | | | | | | Factor the loop for linking input files together into a combined module into a separate function. This is in preparation for an upcoming patch that runs the logic twice. Patch by Luqman Aden! llvm-svn: 235472
* uselistorder: Remove the global bitsDuncan P. N. Exon Smith2015-04-151-9/+12
| | | | | | | | | | | | | Remove all the global bits to do with preserving use-list order by moving the `cl::opt`s to the individual tools that want them. There's a minor functionality change to `libLTO`, in that you can't send in `-preserve-bc-uselistorder=false`, but making that bit settable (if it's worth doing) should be through explicit LTO API. As a drive-by fix, I removed some includes of `UseListOrder.h` that were made unnecessary by recent commits. llvm-svn: 234973
* uselistorder: Pull the assembly bit up out of the printerDuncan P. N. Exon Smith2015-04-151-1/+1
| | | | | | | | Pull the `-preserve-ll-uselistorder` bit up through all the callers of `Module::print()`. I converted callers of `operator<<` to `Module::print()` where necessary to pull the bit through. llvm-svn: 234968
* uselistorder: Pull the bit through WriteToBitcodFile()Duncan P. N. Exon Smith2015-04-151-1/+2
| | | | | | | | | | | Change the callers of `WriteToBitcodeFile()` to pass `true` or `shouldPreserveBitcodeUseListOrder()` explicitly. I left the callers that want to send `false` alone. I'll keep pushing the bit higher until hopefully I can delete the global `cl::opt` entirely. llvm-svn: 234957
* IR: Set -preserve-bc-uselistorder=false by defaultDuncan P. N. Exon Smith2015-04-141-0/+6
| | | | | | | But keep it on by default in `llvm-as`, `opt`, `bugpoint`, `llvm-link`, `llvm-extract`, and `LTOCodeGenerator`. Part of PR5680. llvm-svn: 234921
* tools: Unify how verifyModule() is calledDuncan P. N. Exon Smith2015-03-311-5/+5
| | | | | | | | | Unify the error messages for the various tools when `verifyModule()` fails on an input module. The "brave new way" is: lltool: path/to/input.ll: error: input module is broken! llvm-svn: 233667
* Fix PR23045.Rafael Espindola2015-03-301-5/+3
| | | | | | | | | Keep a note in the materializer that we are stripping debug info so that user doing a lazy read of the module don't hit outdated formats. Thanks to Duncan for suggesting the fix. llvm-svn: 233603
* Work around pr23045 and make it easier to reproduce.Rafael Espindola2015-03-271-0/+6
| | | | | | | | | | | Dropping old debug format requires the entire module to be read upfront. This was failing only with the gold plugin, but that is just because llvm-link was not upgrading metadata. The new testcase using llvm-link shows the problem. llvm-svn: 233381
* llvm-link: Verify input modulesDuncan P. N. Exon Smith2015-03-251-0/+6
| | | | | | | | | | Otherwise, broken input modules can cause assertions. I've updated two of the testcases that started failing (modules that had `Require` flags but didn't meet their own requirements), but Rafael and I decided that test/Linker/2011-08-22-ResolveAlias.ll should just be deleted outright -- it's a leftover of the way llvm-gcc used to implement weakref. llvm-svn: 233229
* Add missing includes. make_unique proliferated everywhere.Benjamin Kramer2015-03-011-0/+1
| | | | llvm-svn: 230909
* Make it easier to pass a custom diagnostic handler to the IR linker.Rafael Espindola2014-10-271-3/+4
| | | | llvm-svn: 220732
* Update the error handling of lib/Linker.Rafael Espindola2014-10-251-6/+24
| | | | | | Instead of passing a std::string&, use the new diagnostic infrastructure. llvm-svn: 220608
* Make llvm-link behave a bit more like LTO.Rafael Espindola2014-10-231-13/+5
| | | | | | | | * Read modules lazily * Don't treat the first file specially, instead merge all inputs into an empty module. llvm-svn: 220501
* Invert the condition to have a single return.Rafael Espindola2014-08-261-4/+3
| | | | | | Thanks to David Blaikie for the suggestion. llvm-svn: 216468
* Return a std::unique_ptr from the IRReader.h functions. NFC.Rafael Espindola2014-08-261-11/+10
| | | | llvm-svn: 216466
* Modernize raw_fd_ostream's constructor a bit.Rafael Espindola2014-08-251-4/+4
| | | | | | | | | | Take a StringRef instead of a "const char *". Take a "std::error_code &" instead of a "std::string &" for error. A create static method would be even better, but this patch is already a bit too big. llvm-svn: 216393
* raw_ostream: Forward declare OpenFlags and include FileSystem.h only where ↵Benjamin Kramer2014-04-291-0/+1
| | | | | | necessary. llvm-svn: 207593
* [C++] Use 'nullptr'. Tools edition.Craig Topper2014-04-251-4/+4
| | | | llvm-svn: 207176
* Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles2014-03-061-3/+3
| | | | | | | | | | This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. llvm-svn: 203083
* [Layering] Sink Linker.h into a Linker subdirectory to make itChandler Carruth2014-03-061-1/+1
| | | | | | consistent with every other sub-library header in LLVM. llvm-svn: 203065
* Replace the F_Binary flag with a F_Text one.Rafael Espindola2014-02-241-1/+1
| | | | | | | | | After this I will set the default back to F_None. The advantage is that before this patch forgetting to set F_Binary would corrupt a file on windows. Forgetting to set F_Text produces one that cannot be read in notepad, which is a better failure mode :-) llvm-svn: 202052
* Set the SuppressWarnings option on tool level and propagate to the library.Eli Bendersky2014-02-201-1/+5
| | | | | | | | | | | | | The SuppressWarnings flag, unfortunately, isn't very useful for custom tools that want to use the LLVM module linker. So I'm changing it to a parameter of the Linker, and the flag itself moves to the llvm-link tool. For the time being as SuppressWarnings is pretty much the only "option" it seems reasonable to propagate it to Linker objects. If we end up with more options in the future, some sort of "struct collecting options" may be a better idea. llvm-svn: 201819
* [cleanup] Move the Dominators.h and Verifier.h headers into the IRChandler Carruth2014-01-131-1/+1
| | | | | | | | | | | | | | | | | | directory. These passes are already defined in the IR library, and it doesn't make any sense to have the headers in Analysis. Long term, I think there is going to be a much better way to divide these matters. The dominators code should be fully separated into the abstract graph algorithm and have that put in Support where it becomes obvious that evn Clang's CFGBlock's can use it. Then the verifier can manually construct dominance information from the Support-driven interface while the Analysis library can provide a pass which both caches, reconstructs, and supports a nice update API. But those are very long term, and so I don't want to leave the really confusing structure until that day arrives. llvm-svn: 199082
* [CMake] Update LLVM_LINK_COMPONENTS for each CMakeLists.txt.NAKAMURA Takumi2013-12-101-1/+7
| | | | llvm-svn: 196908
* Revert "Encapsulate PassManager debug flags to avoid static init and cxa_exit."Andrew Trick2013-09-191-5/+0
| | | | | | | | Working on a better solution to this. This reverts commit 7d4e9934e7ca83094c5cf41346966c8350179ff2. llvm-svn: 190990
* Encapsulate PassManager debug flags to avoid static init and cxa_exit.Andrew Trick2013-09-181-0/+5
| | | | | | | | | | | | | | This puts all the global PassManager debugging flags, like -print-after-all and -time-passes, behind a managed static. This eliminates their static initializers and, more importantly, exit-time destructors. The only behavioral change I anticipate is that tools need to initialize the PassManager before parsing the command line in order to export these options, which makes sense. Tools that already initialize the standard passes (opt/llc) don't need to do anything new. llvm-svn: 190974
* whitespaceAndrew Trick2013-09-181-1/+1
| | | | llvm-svn: 190973
* Add a wrapper for open.Rafael Espindola2013-07-161-2/+1
| | | | | | | This centralizes the handling of O_BINARY and opens the way for hiding more differences (like how open behaves with directories). llvm-svn: 186447
* Don't use PathV1.h in llvm-link.Rafael Espindola2013-06-171-11/+3
| | | | llvm-svn: 184092
* Don't use PathV1.h in Signals.h.Rafael Espindola2013-06-131-0/+1
| | | | llvm-svn: 183947
* Optimize llvm-link too.Rafael Espindola2013-05-041-2/+2
| | | | | | | This takes the linking of almost all modules in a clang build from 6:32 to 0:19. llvm-svn: 181105
* Replace uses of the deprecated std::auto_ptr with OwningPtr.Andy Gibbs2013-04-151-10/+8
| | | | | | This is a rework of the broken parts in r179373 which were subsequently reverted in r179374 due to incompatibility with C++98 compilers. This version should be ok under C++98. llvm-svn: 179520
* Revert broken pieces of r179373.Benjamin Kramer2013-04-121-9/+10
| | | | | | You can't copy an OwningPtr, and move semantics aren't available in C++98. llvm-svn: 179374
* Replace uses of the deprecated std::auto_ptr with OwningPtr.Andy Gibbs2013-04-121-10/+9
| | | | llvm-svn: 179373
* Manually update the dependencies in the Makefiles. It turns out that allChandler Carruth2013-03-261-1/+1
| | | | | | | | | | | that work on the LLVMBuild based dependency specification didn't actually work, we just now maintain dependencies in *3* places instead of 2. Yay. There may still be some missing dependencies, I'm still sifting through the bots and my builds, but this is a step in the right direction. llvm-svn: 177988
* Split out the IRReader header and the utility functions it provides intoChandler Carruth2013-03-263-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | its own library. These functions are bridging between the bitcode reader and the ll parser which are in different libraries. Previously we didn't have any good library to do this, and instead played fast and loose with a "header only" set of interfaces in the Support library. This really doesn't work well as evidenced by the recent attempt to add timing logic to the these routines. As part of this, make them normal functions rather than weird inline functions, and sink the implementation into the library. Also clean up the header to be nice and minimal. This requires updating lots of build system dependencies to specify that the IRReader library is needed, and several source files to not implicitly rely upon the header file to transitively include all manner of other headers. If you are using IRReader.h, this commit will break you (the header moved) and you'll need to also update your library usage to include 'irreader'. I will commit the corresponding change to Clang momentarily. llvm-svn: 177971
* Remove stale commentEli Bendersky2013-03-191-3/+0
| | | | llvm-svn: 177410
OpenPOWER on IntegriCloud