Fixes for PR258 and PR259.
authorJohn Criswell <criswell@uiuc.edu>
Thu, 26 Feb 2004 22:20:58 +0000 (22:20 +0000)
committerJohn Criswell <criswell@uiuc.edu>
Thu, 26 Feb 2004 22:20:58 +0000 (22:20 +0000)
Functions with linkonce linkage are declared with weak linkage.
Global floating point constants used to represent unprintable values
(such as NaN and infinity) are declared static so that they don't interfere
with other CBE generated translation units.

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

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

index 89819dace3b5d982af986a12d00f16a67ab4c5b1..396cc694da6ed06ec038bf713989521b4d970cc9 100644 (file)
@@ -690,6 +690,7 @@ bool CWriter::doInitialization(Module &M) {
       if (!I->getIntrinsicID()) {
         printFunctionSignature(I, true);
         if (I->hasWeakLinkage()) Out << " __ATTRIBUTE_WEAK__";
+        if (I->hasLinkOnceLinkage()) Out << " __ATTRIBUTE_WEAK__";
         Out << ";\n";
       }
     }
@@ -788,12 +789,12 @@ void CWriter::printFloatingPointConstants(Module &M) {
           
           if (FPC->getType() == Type::DoubleTy) {
             DBLUnion.D = Val;
-            Out << "const ConstantDoubleTy FPConstant" << FPCounter++
+            Out << "static const ConstantDoubleTy FPConstant" << FPCounter++
                 << " = 0x" << std::hex << DBLUnion.U << std::dec
                 << "ULL;    /* " << Val << " */\n";
           } else if (FPC->getType() == Type::FloatTy) {
             FLTUnion.F = Val;
-            Out << "const ConstantFloatTy FPConstant" << FPCounter++
+            Out << "static const ConstantFloatTy FPConstant" << FPCounter++
                 << " = 0x" << std::hex << FLTUnion.U << std::dec
                 << "U;    /* " << Val << " */\n";
           } else
@@ -890,7 +891,6 @@ void CWriter::printContainedStructs(const Type *Ty,
 
 void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
   if (F->hasInternalLinkage()) Out << "static ";
-  if (F->hasLinkOnceLinkage()) Out << "inline ";
   
   // Loop over the arguments, printing them...
   const FunctionType *FT = cast<FunctionType>(F->getFunctionType());
index 89819dace3b5d982af986a12d00f16a67ab4c5b1..396cc694da6ed06ec038bf713989521b4d970cc9 100644 (file)
@@ -690,6 +690,7 @@ bool CWriter::doInitialization(Module &M) {
       if (!I->getIntrinsicID()) {
         printFunctionSignature(I, true);
         if (I->hasWeakLinkage()) Out << " __ATTRIBUTE_WEAK__";
+        if (I->hasLinkOnceLinkage()) Out << " __ATTRIBUTE_WEAK__";
         Out << ";\n";
       }
     }
@@ -788,12 +789,12 @@ void CWriter::printFloatingPointConstants(Module &M) {
           
           if (FPC->getType() == Type::DoubleTy) {
             DBLUnion.D = Val;
-            Out << "const ConstantDoubleTy FPConstant" << FPCounter++
+            Out << "static const ConstantDoubleTy FPConstant" << FPCounter++
                 << " = 0x" << std::hex << DBLUnion.U << std::dec
                 << "ULL;    /* " << Val << " */\n";
           } else if (FPC->getType() == Type::FloatTy) {
             FLTUnion.F = Val;
-            Out << "const ConstantFloatTy FPConstant" << FPCounter++
+            Out << "static const ConstantFloatTy FPConstant" << FPCounter++
                 << " = 0x" << std::hex << FLTUnion.U << std::dec
                 << "U;    /* " << Val << " */\n";
           } else
@@ -890,7 +891,6 @@ void CWriter::printContainedStructs(const Type *Ty,
 
 void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
   if (F->hasInternalLinkage()) Out << "static ";
-  if (F->hasLinkOnceLinkage()) Out << "inline ";
   
   // Loop over the arguments, printing them...
   const FunctionType *FT = cast<FunctionType>(F->getFunctionType());