[llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Jul 28 13:59:01 PDT 2006



Changes in directory llvm/lib/Target/CBackend:

Writer.cpp updated: 1.266 -> 1.267
---
Log message:

Make functions with an "asm" name propagate that asm name into the cbe.c file.
This fixes link errors on programs with these on targets with prefixes.


---
Diffs of the changes:  (+6 -0)

 Writer.cpp |    6 ++++++
 1 files changed, 6 insertions(+)


Index: llvm/lib/Target/CBackend/Writer.cpp
diff -u llvm/lib/Target/CBackend/Writer.cpp:1.266 llvm/lib/Target/CBackend/Writer.cpp:1.267
--- llvm/lib/Target/CBackend/Writer.cpp:1.266	Tue Jun 20 17:11:12 2006
+++ llvm/lib/Target/CBackend/Writer.cpp	Fri Jul 28 15:58:47 2006
@@ -921,6 +921,7 @@
                               "__builtin_prefetch(addr,rw,locality)\n"
       << "#define __ATTRIBUTE_CTOR__ __attribute__((constructor))\n"
       << "#define __ATTRIBUTE_DTOR__ __attribute__((destructor))\n"
+      << "#define LLVM_ASM           __asm__\n"
       << "#else\n"
       << "#define LLVM_NAN(NanStr)   ((double)0.0)           /* Double */\n"
       << "#define LLVM_NANF(NanStr)  0.0F                    /* Float */\n"
@@ -931,6 +932,7 @@
       << "#define LLVM_PREFETCH(addr,rw,locality)            /* PREFETCH */\n"
       << "#define __ATTRIBUTE_CTOR__\n"
       << "#define __ATTRIBUTE_DTOR__\n"
+      << "#define LLVM_ASM(X)\n"
       << "#endif\n\n";
 
   // Output target-specific code that should be inserted into main.
@@ -1072,6 +1074,10 @@
         Out << " __ATTRIBUTE_CTOR__";
       if (StaticDtors.count(I))
         Out << " __ATTRIBUTE_DTOR__";
+      
+      if (I->hasName() && I->getName()[0] == 1)
+        Out << " LLVM_ASM(\"" << I->getName().c_str()+1 << "\")";
+          
       Out << ";\n";
     }
   }






More information about the llvm-commits mailing list