Remove trailing whitespace to reduce later commit patch noise.
[oota-llvm.git] / lib / CodeGen / ELFWriter.cpp
index f0da37aca36d00ca3f2f795fd21516782fd3e548..b698178d780db6007b36cf325c3548f65d46ca05 100644 (file)
@@ -174,6 +174,8 @@ bool ELFCodeEmitter::finishFunction(MachineFunction &F) {
   case GlobalValue::WeakLinkage:
     FnSym.SetBind(ELFWriter::ELFSym::STB_WEAK);
     break;
+  case GlobalValue::PrivateLinkage:
+    assert (0 && "PrivateLinkage should not be in the symbol table.");
   case GlobalValue::InternalLinkage:
     FnSym.SetBind(ELFWriter::ELFSym::STB_LOCAL);
     break;
@@ -276,7 +278,7 @@ void ELFWriter::EmitGlobal(GlobalVariable *GV) {
 
   unsigned Align = TM.getTargetData()->getPreferredAlignment(GV);
   unsigned Size  =
-    TM.getTargetData()->getABITypeSize(GV->getType()->getElementType());
+    TM.getTargetData()->getTypePaddedSize(GV->getType()->getElementType());
 
   // If this global has a zero initializer, it is part of the .bss or common
   // section.
@@ -329,7 +331,8 @@ void ELFWriter::EmitGlobal(GlobalVariable *GV) {
 
     // Set the idx of the .bss section
     BSSSym.SectionIdx = BSSSection.SectionIdx;
-    SymbolTable.push_back(BSSSym);
+    if (!GV->hasPrivateLinkage())
+      SymbolTable.push_back(BSSSym);
 
     // Reserve space in the .bss section for this symbol.
     BSSSection.Size += Size;