summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2010-02-05 00:17:02 +0000
committerBill Wendling <isanbard@gmail.com>2010-02-05 00:17:02 +0000
commit6510dc8dc3bb678415e37b3c7ac3af75940d4f58 (patch)
tree98964f1524107923f8bf6f5212c962e4b7e1b21b /llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
parent2233460de6ed1bb3e11d3ba8069bf774a23d710a (diff)
downloadbcm5719-llvm-6510dc8dc3bb678415e37b3c7ac3af75940d4f58.tar.gz
bcm5719-llvm-6510dc8dc3bb678415e37b3c7ac3af75940d4f58.zip
An empty global constant (one of size 0) may have a section immediately
following it. However, the EmitGlobalConstant method wasn't emitting a body for the constant. The assembler doesn't like that. Before, we were generating this: .zerofill __DATA, __common, __cmd, 1, 3 This fix puts us back to that semantic. llvm-svn: 95336
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 8456709dbae..31326911590 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -1120,6 +1120,7 @@ static void EmitGlobalConstantLargeInt(const ConstantInt *CI,
void AsmPrinter::EmitGlobalConstant(const Constant *CV, unsigned AddrSpace) {
if (isa<ConstantAggregateZero>(CV) || isa<UndefValue>(CV)) {
uint64_t Size = TM.getTargetData()->getTypeAllocSize(CV->getType());
+ if (Size == 0) Size = 1; // An empty "_foo:" followed by a section is undef.
return OutStreamer.EmitZeros(Size, AddrSpace);
}
OpenPOWER on IntegriCloud