[llvm-commits] [llvm] r123711 - /llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
Chris Lattner
sabre at nondot.org
Mon Jan 17 17:23:44 PST 2011
Author: lattner
Date: Mon Jan 17 19:23:44 2011
New Revision: 123711
URL: http://llvm.org/viewvc/llvm-project?rev=123711&view=rev
Log:
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.
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=123711&r1=123710&r2=123711&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Mon Jan 17 19:23:44 2011
@@ -162,13 +162,19 @@
// 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())) {
More information about the llvm-commits
mailing list