[llvm-commits] CVS: llvm/tools/llvm-ld/llvm-ld.cpp

Reid Spencer reid at x10sys.com
Wed Jun 7 16:03:31 PDT 2006



Changes in directory llvm/tools/llvm-ld:

llvm-ld.cpp updated: 1.31 -> 1.32
---
Log message:

For PR780: http://llvm.cs.uiuc.edu/PR780 :
1. Add #includes to LinkAllVMCore.h to get Mangler.o and InlineAsm.o
2. Make Mangler.h and InlineAsm.h use the macros to ensure linkage
3. Make each of the tools with --load options include LinkAllVMCore.h
This should be the last set of changes for this bug and 800.


---
Diffs of the changes:  (+19 -1)

 llvm-ld.cpp |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletion(-)


Index: llvm/tools/llvm-ld/llvm-ld.cpp
diff -u llvm/tools/llvm-ld/llvm-ld.cpp:1.31 llvm/tools/llvm-ld/llvm-ld.cpp:1.32
--- llvm/tools/llvm-ld/llvm-ld.cpp:1.31	Sun May 14 13:38:13 2006
+++ llvm/tools/llvm-ld/llvm-ld.cpp	Wed Jun  7 18:03:13 2006
@@ -20,6 +20,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "llvm/LinkAllVMCore.h"
 #include "llvm/Linker.h"
 #include "llvm/System/Program.h"
 #include "llvm/Module.h"
@@ -77,9 +78,12 @@
   cl::desc("Disable writing of compressed bytecode files"));
 
 static cl::list<std::string> PostLinkOpts("post-link-opts",
-  cl::value_desc("path to post-link optimization programs"),
+  cl::value_desc("path"),
   cl::desc("Run one or more optimization programs after linking"));
 
+static cl::list<std::string> XLinker("Xlinker", cl::value_desc("option"),
+  cl::desc("Pass options to the system linker"));
+
 // Compatibility options that are ignored but supported by LD
 static cl::opt<std::string> CO3("soname", cl::Hidden,
   cl::desc("Compatibility option: ignored"));
@@ -93,6 +97,7 @@
 static  cl::opt<std::string> CO6("h", cl::Hidden,
   cl::desc("Compatibility option: ignored"));
 
+
 /// This is just for convenience so it doesn't have to be passed around
 /// everywhere.
 static std::string progname;
@@ -303,12 +308,25 @@
   args.push_back(OutputFilename.c_str());
   args.push_back(InputFilename.c_str());
 
+  // Add in the library paths
+  for (unsigned index = 0; index < LibPaths.size(); index++) {
+    args.push_back("-L");
+    args.push_back(LibPaths[index].c_str());
+  }
+
+  // Add the requested options
+  for (unsigned index = 0; index < XLinker.size(); index++) {
+    args.push_back(XLinker[index].c_str());
+    args.push_back(Libraries[index].c_str());
+  }
+
   // Add in the libraries to link.
   for (unsigned index = 0; index < Libraries.size(); index++)
     if (Libraries[index] != "crtend") {
       args.push_back("-l");
       args.push_back(Libraries[index].c_str());
     }
+
   args.push_back(0);
 
   // Run the compiler to assembly and link together the program.






More information about the llvm-commits mailing list