diff options
| author | Chris Lattner <sabre@nondot.org> | 2011-01-18 01:23:44 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2011-01-18 01:23:44 +0000 |
| commit | ea4e983d703b1598a3a1947f725d4139991d968c (patch) | |
| tree | 4954c572c8ae88dffed1737a33da04c86085522f /llvm/lib/Target | |
| parent | 2652ad251a20c3f6a878763303ae0af037c2a2f9 (diff) | |
| download | bcm5719-llvm-ea4e983d703b1598a3a1947f725d4139991d968c.tar.gz bcm5719-llvm-ea4e983d703b1598a3a1947f725d4139991d968c.zip | |
minor change to rafael's recent patches: if something is
constant but requires a unique address, we can still put it in a
readonly section, just not a mergable one.
llvm-svn: 123711
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/TargetLoweringObjectFile.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Target/TargetLoweringObjectFile.cpp b/llvm/lib/Target/TargetLoweringObjectFile.cpp index eab43fb4276..681beec636b 100644 --- a/llvm/lib/Target/TargetLoweringObjectFile.cpp +++ b/llvm/lib/Target/TargetLoweringObjectFile.cpp @@ -162,13 +162,19 @@ 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() && GVar->hasUnnamedAddr()) { + if (GVar->isConstant()) { // 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. switch (C->getRelocationInfo()) { default: assert(0 && "unknown relocation info kind"); case Constant::NoRelocation: + // If the global is required to have a unique address, it can't be put + // into a mergable section: just drop it into the general read-only + // section instead. + if (!GVar->hasUnnamedAddr()) + return SectionKind::getReadOnly(); + // If initializer is a null-terminated string, put it in a "cstring" // section of the right width. if (const ArrayType *ATy = dyn_cast<ArrayType>(C->getType())) { |

