summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-12-05 19:14:43 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-12-05 19:14:43 +0000
commitf580546960e3ed193146c6986f30889f38a05400 (patch)
treea79bed0927a0885f69a6a2a2a25125bd4f1cf540 /include
parent9b81d9c2e65dd3a256d9132e3469e01787d3100f (diff)
downloadllvm-f580546960e3ed193146c6986f30889f38a05400.tar.gz
llvm-f580546960e3ed193146c6986f30889f38a05400.tar.bz2
llvm-f580546960e3ed193146c6986f30889f38a05400.tar.xz
Fix PR139: \
Add support for ordered linking with the LinkItems function git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18546 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Linker.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/llvm/Linker.h b/include/llvm/Linker.h
index 2e548116d0..5c6a2924e0 100644
--- a/include/llvm/Linker.h
+++ b/include/llvm/Linker.h
@@ -14,6 +14,7 @@
#ifndef LLVM_LINKER_H
#define LLVM_LINKER_H
+#include "llvm/Support/CommandLine.h"
#include <string>
#include <vector>
#include <set>
@@ -22,6 +23,42 @@ namespace llvm {
class Module;
+/// This type is used to pass the linkage items (libraries and files) to
+/// the LinkItems function. It is composed of string/bool pairs. The string
+/// provides the name of the file or library (as with the -l option). The bool
+/// should be true for libraries, false for files, signifying "isLibrary".
+/// @brief A list of string/bool pairs
+typedef std::vector<std::pair<std::string,bool> > LinkItemList;
+
+/// This function can be used to link a set of linkage items into a module. A
+/// linkage item is one of the three things identified by the LinkItemKind
+/// enumeration. This function allows linking to preserve the order of
+/// specification associated with a command line, or for other purposes. Each
+/// item will be linked in turn as it occurs in \p Items. Note that library
+/// path items will only be in effect after they have been processed.
+/// @returns The aggregated/linked Module.
+/// @throws nothing
+Module* LinkItems (
+ const char * progname, ///< Name of the program being linked (for output)
+ const LinkItemList& Items, // Set of libraries/files to link in
+ const std::vector<std::string>& LibPaths, // Paths to search for libraries
+ bool Verbose, ///< Link verbosely, indicating each action
+ bool Native ///< Linking is for a native executable
+);
+
+/// This function provides some utility for tools that need to build the list
+/// of link items from a triplet of command line options: Files, Libraries, and
+/// LibraryPaths. The command line ordering is preserved by this function even
+/// though the options are split into three separate cl::list<std::string>. The
+/// resulting \p OutList is suitable for use with LinkItems.
+/// @see LinkItems
+/// @throws nothing
+void BuildLinkItems(
+ LinkItemList& OutList,
+ const cl::list<std::string>& Files, ///< List of files to put in list
+ const cl::list<std::string>& Libs ///< List of libraries to put in list
+);
+
/// This is the heart of the linker. The \p Src module is linked into the \p
/// Dest module. If an error occurs, true is returned, otherwise false. If \p
/// ErrorMsg is not null and an error occurs, \p *ErrorMsg will be set to a