Make functions with an "asm" name propagate that asm name into the cbe.c file.
authorChris Lattner <sabre@nondot.org>
Fri, 28 Jul 2006 20:58:47 +0000 (20:58 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 28 Jul 2006 20:58:47 +0000 (20:58 +0000)
This fixes link errors on programs with these on targets with prefixes.

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

lib/Target/CBackend/CBackend.cpp
lib/Target/CBackend/Writer.cpp

index 7fdc06008d50a44167244fcd27d4e051a8688ade..cbd13601a3e6639d85ffe936c74b872ab765e307 100644 (file)
@@ -921,6 +921,7 @@ static void generateCompilerSpecificCode(std::ostream& Out) {
                               "__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 @@ static void generateCompilerSpecificCode(std::ostream& Out) {
       << "#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 @@ bool CWriter::doInitialization(Module &M) {
         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";
     }
   }
index 7fdc06008d50a44167244fcd27d4e051a8688ade..cbd13601a3e6639d85ffe936c74b872ab765e307 100644 (file)
@@ -921,6 +921,7 @@ static void generateCompilerSpecificCode(std::ostream& Out) {
                               "__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 @@ static void generateCompilerSpecificCode(std::ostream& Out) {
       << "#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 @@ bool CWriter::doInitialization(Module &M) {
         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";
     }
   }