X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FLinker.h;h=1e817b467432662f61003b851fba86362ad437c5;hb=fc82fabe00b0b820e3c0d7fc9e289bace0295f11;hp=60227a724d837746518b95e48de954c2f29c526b;hpb=9769ab22265b313171d201b5928688524a01bd87;p=oota-llvm.git diff --git a/include/llvm/Linker.h b/include/llvm/Linker.h index 60227a724d8..1e817b46743 100644 --- a/include/llvm/Linker.h +++ b/include/llvm/Linker.h @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file was developed by Reid Spencer and is distributed under the -// University of Illinois Open Source License. See LICENSE.TXT for details. +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // @@ -16,6 +16,7 @@ #include "llvm/System/Path.h" #include +#include namespace llvm { @@ -27,7 +28,7 @@ class Module; /// In this case the Linker still retains ownership of the Module. If the /// releaseModule() method is used, the ownership of the Module is transferred /// to the caller and the Linker object is only suitable for destruction. -/// The Linker can link Modules from memory, bytecode files, or bytecode +/// The Linker can link Modules from memory, bitcode files, or bitcode /// archives. It retains a set of search paths in which to find any libraries /// presented to it. By default, the linker will generate error and warning /// messages to std::cerr but this capability can be turned off with the @@ -52,7 +53,7 @@ class Linker { enum ControlFlags { Verbose = 1, ///< Print to std::cerr what steps the linker is taking QuietWarnings = 2, ///< Don't print errors and warnings to std::cerr. - QuietErrors = 4, ///< Indicate that this link is for a native executable + QuietErrors = 4 ///< Indicate that this link is for a native executable }; /// @} @@ -62,7 +63,11 @@ class Linker { /// Construct the Linker with an empty module which will be given the /// name \p progname. \p progname will also be used for error messages. /// @brief Construct with empty module - Linker(const std::string& progname, unsigned Flags = 0 ); + Linker( + const std::string& progname, ///< name of tool running linker + const std::string& modulename, ///< name of linker's end-result module + unsigned Flags = 0 ///< ControlFlags (one or more |'d together) + ); /// Construct the Linker with a previously defined module, \p aModule. Use /// \p progname for the name of the program in error messages. @@ -153,13 +158,14 @@ class Linker { /// @see getLastError /// @throws nothing bool LinkInItems ( - const ItemList& Items // Set of libraries/files to link in + const ItemList& Items, ///< Set of libraries/files to link in + ItemList& NativeItems ///< Output list of native files/libs ); - /// This function links the bytecode \p Files into the composite module. + /// This function links the bitcode \p Files into the composite module. /// Note that this does not do any linking of unresolved symbols. The \p /// Files are all completely linked into \p HeadModule regardless of - /// unresolved symbols. This function just loads each bytecode file and + /// unresolved symbols. This function just loads each bitcode file and /// calls LinkInModule on them. /// @returns true if an error occurs, false otherwise /// @see getLastError @@ -168,15 +174,16 @@ class Linker { const std::vector & Files ///< Files to link in ); - /// This function links a single bytecode file, \p File, into the composite + /// This function links a single bitcode file, \p File, into the composite /// module. Note that this does not attempt to resolve symbols. This method - /// just loads the bytecode file and calls LinkInModule on it. If an error + /// just loads the bitcode file and calls LinkInModule on it. If an error /// occurs, the Linker's error string is set. /// @returns true if an error occurs, false otherwise /// @see getLastError /// @brief Link in a single file. bool LinkInFile( - const sys::Path& File ///< File to link in. + const sys::Path& File, ///< File to link in. + bool &is_native ///< Indicates if the file is native object file ); /// This function provides a way to selectively link in a set of modules, @@ -197,7 +204,7 @@ class Linker { /// found in one library, based on the unresolved symbols in the composite /// module.The \p Library should be the base name of a library, as if given /// with the -l option of a linker tool. The Linker's LibPaths are searched - /// for the \P Library and if found, it will be linked in with via the + /// for the \p Library and if found, it will be linked in with via the /// LinkInArchive method. If an error occurs, the Linker's error string is /// set. /// @see LinkInArchive @@ -205,10 +212,11 @@ class Linker { /// @returns true if an error occurs, false otherwise /// @brief Link one library into the module bool LinkInLibrary ( - const std::string& Library ///< The library to link in + const std::string& Library, ///< The library to link in + bool& is_native ///< Indicates if lib a native library ); - /// This function links one bytecode archive, \p Filename, into the module. + /// This function links one bitcode archive, \p Filename, into the module. /// The archive is searched to resolve outstanding symbols. Any modules in /// the archive that resolve outstanding symbols will be linked in. The /// library is searched repeatedly until no more modules that resolve @@ -221,7 +229,8 @@ class Linker { /// @returns true if an error occurs, otherwise false. /// @brief Link in one archive. bool LinkInArchive( - const sys::Path& Filename ///< Filename of the archive to link + const sys::Path& Filename, ///< Filename of the archive to link + bool& is_native ///< Indicates if archive is a native archive ); /// This method links the \p Src module into the Linker's Composite module @@ -232,8 +241,11 @@ class Linker { /// @returns True if an error occurs, false otherwise. /// @brief Link in a module. bool LinkInModule( - Module* Src ///< Module linked into \p Dest - ) { return LinkModules(Composite, Src, &Error); } + Module* Src, ///< Module linked into \p Dest + std::string* ErrorMsg = 0 /// Error/diagnostic string + ) { + return LinkModules(Composite, Src, ErrorMsg ); + } /// This is the heart of the linker. This method will take unconditional /// control of the \p Src module and link it into the \p Dest module. The @@ -259,7 +271,7 @@ class Linker { /// @name Implementation /// @{ private: - /// Read in and parse the bytecode file named by FN and return the + /// Read in and parse the bitcode file named by FN and return the /// Module it contains (wrapped in an auto_ptr), or 0 if an error occurs. std::auto_ptr LoadObject(const sys::Path& FN);