Adjust the constructor to the Linker class to take an argument that names
authorReid Spencer <rspencer@reidspencer.com>
Tue, 13 Dec 2005 20:00:37 +0000 (20:00 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Tue, 13 Dec 2005 20:00:37 +0000 (20:00 +0000)
the module being constructed. This is used to correctly name the module.
Previously the name of the linker tool was used which produces confusing
output when the module identifier is used in an error message.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24699 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Linker.h
lib/Linker/Linker.cpp
tools/gccld/gccld.cpp
tools/llvm-ld/llvm-ld.cpp

index 60227a724d837746518b95e48de954c2f29c526b..d1854cc6296591692bbcb45e99c46d90c8fdf279 100644 (file)
@@ -62,7 +62,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.
index c72f1b5aca8083690a1e384d6fc026d2e5223bcc..9ffe7a121e066e6e7fad5cb9dcd6a4ca7b421bc8 100644 (file)
 
 using namespace llvm;
 
-Linker::Linker(const std::string& progname, unsigned flags)
+Linker::Linker(const std::string& progname, const std::string& modname, unsigned flags)
   : Composite(0)
   , LibPaths()
   , Flags(flags)
   , Error()
   , ProgramName(progname)
 {
-  Composite = new Module(progname);
+  Composite = new Module(modname);
 }
 
 Linker::Linker(const std::string& progname, Module* aModule, unsigned flags)
index bad4a9cf06bb8101f2df9dcdab19cdeaa90c4528..644ee7997aa111d2c7243050682818db9f9f4aaf 100644 (file)
@@ -107,6 +107,10 @@ namespace {
   CO5("eh-frame-hdr", cl::Hidden, cl::desc("Compatibility option: ignored"));
   cl::opt<std::string>
   CO6("h", cl::Hidden, cl::desc("Compatibility option: ignored"));
+  cl::opt<bool>
+  CO7("start-group", cl::Hidden, cl::desc("Compatibility option: ignored"));
+  cl::opt<bool>
+  CO8("end-group", cl::Hidden, cl::desc("Compatibility option: ignored"));
 
   cl::alias A0("s", cl::desc("Alias for --strip-all"),
                cl::aliasopt(Strip));
@@ -211,7 +215,7 @@ int main(int argc, char **argv, char **envp ) {
   int exitCode = 0;
 
   std::string ProgName = sys::Path(argv[0]).getBasename();
-  Linker TheLinker(ProgName, Verbose);
+  Linker TheLinker(ProgName, OutputFilename, Verbose);
 
   try {
     // Remove any consecutive duplicates of the same library...
index 65a220a3acb8e9f98299f8ceff2a57b97a4d870f..03f1c45cb4f57c8b2925caf21bc3b7f4acf59346 100644 (file)
@@ -400,7 +400,7 @@ int main(int argc, char **argv, char **envp) {
   try {
     // Initial global variable above for convenience printing of program name.
     progname = sys::Path(argv[0]).getBasename();
-    Linker TheLinker(progname, Verbose);
+    Linker TheLinker(progname, OutputFilename, Verbose);
 
     // Set up the library paths for the Linker
     TheLinker.addPaths(LibPaths);