[llvm-commits] CVS: llvm/lib/Linker/LinkArchives.cpp LinkItems.cpp

Reid Spencer reid at x10sys.com
Sun Apr 29 17:30:00 PDT 2007



Changes in directory llvm/lib/Linker:

LinkArchives.cpp updated: 1.56 -> 1.57
LinkItems.cpp updated: 1.13 -> 1.14
---
Log message:

If an archive is not recognized as an LLVM bytecode archive then declare
that it is native so that the linker will pass it on downstream. This avoids
a problem where the native link line fails because there is both a .so and
a .a file. The .a file gets processed as bytecode and then dropped from the
command line.


---
Diffs of the changes:  (+8 -3)

 LinkArchives.cpp |    7 ++++++-
 LinkItems.cpp    |    4 ++--
 2 files changed, 8 insertions(+), 3 deletions(-)


Index: llvm/lib/Linker/LinkArchives.cpp
diff -u llvm/lib/Linker/LinkArchives.cpp:1.56 llvm/lib/Linker/LinkArchives.cpp:1.57
--- llvm/lib/Linker/LinkArchives.cpp:1.56	Mon Feb  5 15:19:13 2007
+++ llvm/lib/Linker/LinkArchives.cpp	Sun Apr 29 19:29:39 2007
@@ -88,7 +88,7 @@
 ///  TRUE  - An error occurred.
 ///  FALSE - No errors.
 bool
-Linker::LinkInArchive(const sys::Path &Filename) {
+Linker::LinkInArchive(const sys::Path &Filename, bool &is_native) {
 
   // Make sure this is an archive file we're dealing with
   if (!Filename.isArchive())
@@ -118,6 +118,11 @@
   if (!arch)
     return error("Cannot read archive '" + Filename.toString() +
                  "': " + ErrMsg);
+  if (!arch->isBytecodeArchive()) {
+    is_native = true;
+    return false;
+  }
+  is_native = false;
 
   // Save a set of symbols that are not defined by the archive. Since we're
   // entering a loop, there's no point searching for these multiple times. This


Index: llvm/lib/Linker/LinkItems.cpp
diff -u llvm/lib/Linker/LinkItems.cpp:1.13 llvm/lib/Linker/LinkItems.cpp:1.14
--- llvm/lib/Linker/LinkItems.cpp:1.13	Sun Apr 29 19:00:10 2007
+++ llvm/lib/Linker/LinkItems.cpp	Sun Apr 29 19:29:39 2007
@@ -90,7 +90,7 @@
       break;
 
     case sys::Archive_FileType:
-      if (LinkInArchive(Pathname))
+      if (LinkInArchive(Pathname, is_native))
         return error("Cannot link archive '" + Pathname.toString() + "'");
       break;
 
@@ -171,7 +171,7 @@
       // A user may specify an ar archive without -l, perhaps because it
       // is not installed as a library. Detect that and link the archive.
       verbose("Linking archive file '" + File.toString() + "'");
-      if (LinkInArchive(File))
+      if (LinkInArchive(File, is_native))
         return error("Cannot link archive '" + File.toString() + "'");
       break;
 






More information about the llvm-commits mailing list