Only put unnamed_addr constants in mergeable sections. Fixes PR8297.
authorRafael Espindola <rafael.espindola@gmail.com>
Sun, 16 Jan 2011 17:19:34 +0000 (17:19 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Sun, 16 Jan 2011 17:19:34 +0000 (17:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123585 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/TargetLoweringObjectFile.cpp

index 0e67fe5d9877be59ef67df74e44bb328bfdaacef..eab43fb4276498e1ad269e3d755df6621e682da1 100644 (file)
@@ -162,7 +162,7 @@ SectionKind TargetLoweringObjectFile::getKindForGlobal(const GlobalValue *GV,
 
   // If the global is marked constant, we can put it into a mergable section,
   // a mergable string section, or general .data if it contains relocations.
-  if (GVar->isConstant()) {
+  if (GVar->isConstant() && GVar->hasUnnamedAddr()) {
     // If the initializer for the global contains something that requires a
     // relocation, then we may have to drop this into a wriable data section
     // even though it is marked const.