From 7610c57d4b7e9508a096e8418b863b83057eaf24 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 29 Jul 2009 04:54:38 +0000 Subject: [PATCH] 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. llvm-svn: 77429 --- llvm/lib/Target/TargetLoweringObjectFile.cpp | 30 ++++++++++------------------ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/llvm/lib/Target/TargetLoweringObjectFile.cpp b/llvm/lib/Target/TargetLoweringObjectFile.cpp index 7bd6788..379099b 100644 --- a/llvm/lib/Target/TargetLoweringObjectFile.cpp +++ b/llvm/lib/Target/TargetLoweringObjectFile.cpp @@ -412,28 +412,18 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, if (Kind.isText()) return TextSection; if (Kind.isMergeableCString()) { - //Constant *C = cast(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(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(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(GV)); - return ReadOnlySection; + std::string Name = CStringSection_->getName() + utostr(Size) + '.' + + utostr(Align); + return getOrCreateSection(Name.c_str(), false, + SectionKind::MergeableCString); } if (Kind.isMergeableConst()) { -- 2.7.4