[llvm-commits] [llvm] r77429 - /llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp

Chris Lattner sabre at nondot.org
Tue Jul 28 21:54:45 PDT 2009


Author: lattner
Date: Tue Jul 28 23:54:38 2009
New Revision: 77429

URL: http://llvm.org/viewvc/llvm-project?rev=77429&view=rev
Log:
remove some completely wrong code.  1 is never < 16.  It turns out that GCC appears to put strings of any length into the ELF cstring equivalent, so just rip out the code.

Modified:
    llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp

Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=77429&r1=77428&r2=77429&view=diff

==============================================================================
--- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Tue Jul 28 23:54:38 2009
@@ -412,28 +412,18 @@
   
   if (Kind.isText()) return TextSection;
   if (Kind.isMergeableCString()) {
-    //Constant *C = cast<GlobalVariable>(GV)->getInitializer();
+   assert(CStringSection_ && "Should have string section prefix");
     
-    // FIXME: This is completely wrong.  Why is it comparing the size of the
-    // character type to 1?
-    /// cast<ArrayType>(C->getType())->getNumElements();
-    uint64_t Size = 1;
-    if (Size <= 16) {
-      assert(CStringSection_ && "Should have string section prefix");
-      
-      // We also need alignment here.
-      // FIXME: this is getting the alignment of the character, not the
-      // alignment of the global!
-      unsigned Align = 
-        TM.getTargetData()->getPreferredAlignment(cast<GlobalVariable>(GV));
-      
-      std::string Name = CStringSection_->getName() + utostr(Size) + '.' +
-      utostr(Align);
-      return getOrCreateSection(Name.c_str(), false,
-                                SectionKind::MergeableCString);
-    }
+    // We also need alignment here.
+    // FIXME: this is getting the alignment of the character, not the
+    // alignment of the global!
+    unsigned Align = 
+      TM.getTargetData()->getPreferredAlignment(cast<GlobalVariable>(GV));
     
-    return ReadOnlySection;
+    std::string Name = CStringSection_->getName() + utostr(Size) + '.' +
+    utostr(Align);
+    return getOrCreateSection(Name.c_str(), false,
+                              SectionKind::MergeableCString);
   }
   
   if (Kind.isMergeableConst()) {





More information about the llvm-commits mailing list