Be bug compatible with gcc by returning MMX values in RAX.
[oota-llvm.git] / lib / Target / ELFTargetAsmInfo.cpp
index 47727d111f12b6ab5c5ccd62954e71228bfb3a00..624b95c7b6c162e643545d7665d0c968a507c83a 100644 (file)
@@ -44,6 +44,7 @@ ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
   if (const Function *F = dyn_cast<Function>(GV)) {
     switch (F->getLinkage()) {
      default: assert(0 && "Unknown linkage type!");
+     case Function::PrivateLinkage:
      case Function::InternalLinkage:
      case Function::DLLExportLinkage:
      case Function::ExternalLinkage:
@@ -86,6 +87,8 @@ ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
     }
   } else
     assert(0 && "Unsupported global");
+
+  return NULL;
 }
 
 const Section*
@@ -107,7 +110,7 @@ ELFTargetAsmInfo::MergeableConstSection(const Type *Ty) const {
   // FIXME: string here is temporary, until stuff will fully land in.
   // We cannot use {Four,Eight,Sixteen}ByteConstantSection here, since it's
   // currently directly used by asmprinter.
-  unsigned Size = TD->getABITypeSize(Ty);
+  unsigned Size = TD->getTypePaddedSize(Ty);
   if (Size == 4 || Size == 8 || Size == 16) {
     std::string Name =  ".rodata.cst" + utostr(Size);
 
@@ -123,10 +126,9 @@ const Section*
 ELFTargetAsmInfo::MergeableStringSection(const GlobalVariable *GV) const {
   const TargetData *TD = TM.getTargetData();
   Constant *C = cast<GlobalVariable>(GV)->getInitializer();
-  const ConstantArray *CVA = cast<ConstantArray>(C);
-  const Type *Ty = CVA->getType()->getElementType();
+  const Type *Ty = cast<ArrayType>(C->getType())->getElementType();
 
-  unsigned Size = TD->getABITypeSize(Ty);
+  unsigned Size = TD->getTypePaddedSize(Ty);
   if (Size <= 16) {
     assert(getCStringSection() && "Should have string section prefix");
 
@@ -182,4 +184,3 @@ std::string ELFTargetAsmInfo::printSectionFlags(unsigned flags) const {
 
   return Flags;
 }
-