improve the default impl of getSectionForMergableConstant by
authorChris Lattner <sabre@nondot.org>
Sun, 26 Jul 2009 05:57:07 +0000 (05:57 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 26 Jul 2009 05:57:07 +0000 (05:57 +0000)
putting readonly constants in the readonly section if we have one.

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

lib/Target/TargetAsmInfo.cpp

index 02e01be5dfe63330325470096ccc9405e191d444..51042dac9588a4214537f7a7ea4ec63a15833150 100644 (file)
@@ -364,8 +364,10 @@ TargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV,
 const Section *
 TargetAsmInfo::getSectionForMergableConstant(uint64_t Size,
                                              unsigned ReloInfo) const {
-  // FIXME: Support data.rel stuff someday
-  // Lame default implementation. Calculate the section name for machine const.
+  if (ReloInfo == 0)
+    if (const Section *S = getReadOnlySection())
+      return S;
+  
   return getDataSection();
 }