Roll out r126425 and r126450 to see if it fixes the failures on the buildbots.

llvm-svn: 126488
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
index e7418d2..98a1bf2 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
@@ -177,8 +177,9 @@
 void AsmPrinter::EmitSectionOffset(const MCSymbol *Label,
                                    const MCSymbol *SectionLabel) const {
   // On COFF targets, we have to emit the special .secrel32 directive.
-  if (MAI->getDwarfSectionOffsetDirective()) {
-    OutStreamer.EmitCOFFSecRel32(Label);
+  if (const char *SecOffDir = MAI->getDwarfSectionOffsetDirective()) {
+    // FIXME: MCize.
+    OutStreamer.EmitRawText(SecOffDir + Twine(Label->getName()));
     return;
   }
   
diff --git a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
index ff3c6da..21396ca 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
@@ -277,29 +277,6 @@
 #endif
 
 //===----------------------------------------------------------------------===//
-// DIESectionOffset Implementation
-//===----------------------------------------------------------------------===//
-
-/// EmitValue - Emit label value.
-///
-void DIESectionOffset::EmitValue(AsmPrinter *AP, unsigned Form) const {
-  AP->EmitSectionOffset (Label, Label);
-}
-
-/// SizeOf - Determine size of label value in bytes.
-///
-unsigned DIESectionOffset::SizeOf(AsmPrinter *AP, unsigned Form) const {
-  if (Form == dwarf::DW_FORM_data4) return 4;
-  return AP->getTargetData().getPointerSize();
-}
-
-#ifndef NDEBUG
-void DIESectionOffset::print(raw_ostream &O) {
-  O << "SecRelLbl: " << Label->getName();
-}
-#endif
-
-//===----------------------------------------------------------------------===//
 // DIEDelta Implementation
 //===----------------------------------------------------------------------===//
 
diff --git a/llvm/lib/CodeGen/AsmPrinter/DIE.h b/llvm/lib/CodeGen/AsmPrinter/DIE.h
index bf5768a..d56c094 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DIE.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DIE.h
@@ -333,36 +333,6 @@
   };
 
   //===--------------------------------------------------------------------===//
-  /// DIESectionOffset - A section relative label expression DIE.
-  //
-  class DIESectionOffset : public DIEValue {
-    const MCSymbol *Label;
-  public:
-    explicit DIESectionOffset(const MCSymbol *L) : DIEValue(isSectionOffset),
-      Label(L) {}
-
-    /// EmitValue - Emit label value.
-    ///
-    virtual void EmitValue(AsmPrinter *AP, unsigned Form) const;
-
-    /// getValue - Get MCSymbol.
-    ///
-    const MCSymbol *getValue()       const { return Label; }
-
-    /// SizeOf - Determine size of label value in bytes.
-    ///
-    virtual unsigned SizeOf(AsmPrinter *AP, unsigned Form) const;
-
-    // Implement isa/cast/dyncast.
-    static bool classof(const DIELabel *)  { return true; }
-    static bool classof(const DIEValue *L) { return L->getType() == isSectionOffset; }
-
-#ifndef NDEBUG
-    virtual void print(raw_ostream &O);
-#endif
-  };
-
-  //===--------------------------------------------------------------------===//
   /// DIEDelta - A simple label difference DIE.
   ///
   class DIEDelta : public DIEValue {
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 9678078..780fa40 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -481,15 +481,6 @@
   Die->addValue(Attribute, Form, Value);
 }
 
-/// addSectionOffset - Add a Dwarf section relative label attribute data and
-/// value.
-///
-void DwarfDebug::addSectionOffset(DIE *Die, unsigned Attribute, unsigned Form,
-                          const MCSymbol *Label) {
-  DIEValue *Value = new (DIEValueAllocator) DIESectionOffset(Label);
-  Die->addValue(Attribute, Form, Value);
-}
-
 /// addDelta - Add a label delta attribute data and value.
 ///
 void DwarfDebug::addDelta(DIE *Die, unsigned Attribute, unsigned Form,
@@ -1913,8 +1904,8 @@
   // DW_AT_stmt_list is a offset of line number information for this
   // compile unit in debug_line section.
   if (Asm->MAI->doesDwarfUsesAbsoluteLabelForStmtList())
-    addSectionOffset(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_addr,
-                     Asm->GetTempSymbol("section_line"));
+    addLabel(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_addr,
+             Asm->GetTempSymbol("section_line"));
   else
     addUInt(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4, 0);
 
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
index 2e920f5..7df0510 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -280,12 +280,6 @@
   void addLabel(DIE *Die, unsigned Attribute, unsigned Form,
                 const MCSymbol *Label);
 
-  /// addSectionOffset - Add a Dwarf section relative label attribute data and
-  /// value.
-  ///
-  void addSectionOffset(DIE *Die, unsigned Attribute, unsigned Form,
-                const MCSymbol *Label);
-
   /// addDelta - Add a label delta attribute data and value.
   ///
   void addDelta(DIE *Die, unsigned Attribute, unsigned Form,
diff --git a/llvm/lib/MC/MCAsmInfoCOFF.cpp b/llvm/lib/MC/MCAsmInfoCOFF.cpp
index f6e2405..7fc7d7a 100644
--- a/llvm/lib/MC/MCAsmInfoCOFF.cpp
+++ b/llvm/lib/MC/MCAsmInfoCOFF.cpp
@@ -33,6 +33,5 @@
   HasLEB128 = true;  // Target asm supports leb128 directives (little-endian)
   SupportsDebugInformation = true;
   DwarfSectionOffsetDirective = "\t.secrel32\t";
-  DwarfUsesAbsoluteLabelForStmtList = false;
   HasMicrosoftFastStdCallMangling = true;
 }
diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp
index 64fa8dd..8d06982 100644
--- a/llvm/lib/MC/MCAsmStreamer.cpp
+++ b/llvm/lib/MC/MCAsmStreamer.cpp
@@ -135,7 +135,6 @@
   virtual void EmitCOFFSymbolStorageClass(int StorageClass);
   virtual void EmitCOFFSymbolType(int Type);
   virtual void EndCOFFSymbolDef();
-  virtual void EmitCOFFSecRel32(MCSymbol const *Symbol);
   virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value);
   virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
                                 unsigned ByteAlignment);
@@ -385,11 +384,6 @@
   EmitEOL();
 }
 
-void MCAsmStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol) {
-  OS << "\t.secrel32\t" << *Symbol << '\n';
-  EmitEOL();
-}
-
 void MCAsmStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {
   assert(MAI.hasDotTypeDotSizeDirective());
   OS << "\t.size\t" << *Symbol << ", " << *Value << '\n';
diff --git a/llvm/lib/MC/MCELFStreamer.cpp b/llvm/lib/MC/MCELFStreamer.cpp
index bd55055..e49074d 100644
--- a/llvm/lib/MC/MCELFStreamer.cpp
+++ b/llvm/lib/MC/MCELFStreamer.cpp
@@ -108,10 +108,6 @@
     assert(0 && "ELF doesn't support this directive");
   }
 
-  virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) {
-    assert(0 && "ELF doesn't support this directive");
-  }
-
   virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {
      MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
      SD.setSize(Value);
diff --git a/llvm/lib/MC/MCLoggingStreamer.cpp b/llvm/lib/MC/MCLoggingStreamer.cpp
index bb01167..012c7f6 100644
--- a/llvm/lib/MC/MCLoggingStreamer.cpp
+++ b/llvm/lib/MC/MCLoggingStreamer.cpp
@@ -120,11 +120,6 @@
     return Child->EndCOFFSymbolDef();
   }
 
-  virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) {
-    LogCall("EndCOFFSymbolDef");
-    return Child->EmitCOFFSecRel32(Symbol);
-  }
-
   virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {
     LogCall("EmitELFSize");
     return Child->EmitELFSize(Symbol, Value);
diff --git a/llvm/lib/MC/MCMachOStreamer.cpp b/llvm/lib/MC/MCMachOStreamer.cpp
index a21dc19..d1f9f5c 100644
--- a/llvm/lib/MC/MCMachOStreamer.cpp
+++ b/llvm/lib/MC/MCMachOStreamer.cpp
@@ -63,9 +63,6 @@
   virtual void EndCOFFSymbolDef() {
     assert(0 && "macho doesn't support this directive");
   }
-  virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) {
-    assert(0 && "macho doesn't support this directive");
-  }
   virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {
     assert(0 && "macho doesn't support this directive");
   }
diff --git a/llvm/lib/MC/MCNullStreamer.cpp b/llvm/lib/MC/MCNullStreamer.cpp
index 25844e4..08ddf01 100644
--- a/llvm/lib/MC/MCNullStreamer.cpp
+++ b/llvm/lib/MC/MCNullStreamer.cpp
@@ -54,7 +54,6 @@
     virtual void EmitCOFFSymbolStorageClass(int StorageClass) {}
     virtual void EmitCOFFSymbolType(int Type) {}
     virtual void EndCOFFSymbolDef() {}
-    virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) {}
 
     virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {}
     virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
diff --git a/llvm/lib/MC/MCPureStreamer.cpp b/llvm/lib/MC/MCPureStreamer.cpp
index 9e80b3b..6098e6b 100644
--- a/llvm/lib/MC/MCPureStreamer.cpp
+++ b/llvm/lib/MC/MCPureStreamer.cpp
@@ -83,9 +83,6 @@
   virtual void EndCOFFSymbolDef() {
     report_fatal_error("unsupported directive in pure streamer");
   }
-  virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) {
-    report_fatal_error("unsupported directive in pure streamer");
-  }
   virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {
     report_fatal_error("unsupported directive in pure streamer");
   }
diff --git a/llvm/lib/MC/WinCOFFObjectWriter.cpp b/llvm/lib/MC/WinCOFFObjectWriter.cpp
index dca4cdd..6ca5d37 100644
--- a/llvm/lib/MC/WinCOFFObjectWriter.cpp
+++ b/llvm/lib/MC/WinCOFFObjectWriter.cpp
@@ -705,10 +705,6 @@
     else
       llvm_unreachable("unsupported relocation type");
     break;
-  case X86::reloc_coff_secrel32:
-    Reloc.Data.Type = Is64Bit ? COFF::IMAGE_REL_AMD64_SREL32
-                              : COFF::IMAGE_REL_I386_SECREL;
-    break;
   default:
     llvm_unreachable("unsupported relocation type");
   }
diff --git a/llvm/lib/MC/WinCOFFStreamer.cpp b/llvm/lib/MC/WinCOFFStreamer.cpp
index ebcf24a..46968e6 100644
--- a/llvm/lib/MC/WinCOFFStreamer.cpp
+++ b/llvm/lib/MC/WinCOFFStreamer.cpp
@@ -31,9 +31,6 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/raw_ostream.h"
-
-#include "../Target/X86/X86FixupKinds.h"
-
 using namespace llvm;
 
 namespace {
@@ -62,7 +59,6 @@
   virtual void EmitCOFFSymbolStorageClass(int StorageClass);
   virtual void EmitCOFFSymbolType(int Type);
   virtual void EndCOFFSymbolDef();
-  virtual void EmitCOFFSecRel32(MCSymbol const *Symbol);
   virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value);
   virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
                                 unsigned ByteAlignment);
@@ -294,16 +290,6 @@
   CurSymbol = NULL;
 }
 
-void WinCOFFStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol)
-{
-  MCDataFragment *DF = getOrCreateDataFragment();
-
-  DF->addFixup(MCFixup::Create(DF->getContents().size(),
-                               MCSymbolRefExpr::Create (Symbol, getContext ()),
-                               (MCFixupKind)X86::reloc_coff_secrel32));
-  DF->getContents().resize(DF->getContents().size() + 4, 0);
-}
-
 void WinCOFFStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {
   llvm_unreachable("not implemented");
 }
@@ -382,10 +368,6 @@
 
   getCurrentSectionData()->setHasInstructions(true);
 
-  // Now that a machine instruction has been assembled into this section, make
-  // a line entry for any .loc directive that has been seen.
-  MCLineEntry::Make(this, getCurrentSection());
-
   MCInstFragment *Fragment =
     new MCInstFragment(Instruction, getCurrentSectionData());
 
diff --git a/llvm/lib/Target/PTX/PTXMCAsmStreamer.cpp b/llvm/lib/Target/PTX/PTXMCAsmStreamer.cpp
index da62ebf..0886ba8 100644
--- a/llvm/lib/Target/PTX/PTXMCAsmStreamer.cpp
+++ b/llvm/lib/Target/PTX/PTXMCAsmStreamer.cpp
@@ -124,7 +124,6 @@
   virtual void EmitCOFFSymbolStorageClass(int StorageClass);
   virtual void EmitCOFFSymbolType(int Type);
   virtual void EndCOFFSymbolDef();
-  virtual void EmitCOFFSecRel32(MCSymbol const *Symbol);
   virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value);
   virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
                                 unsigned ByteAlignment);
@@ -278,8 +277,6 @@
 
 void PTXMCAsmStreamer::EndCOFFSymbolDef() {}
 
-void PTXMCAsmStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol) {}
-
 void PTXMCAsmStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {}
 
 void PTXMCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
diff --git a/llvm/lib/Target/X86/X86AsmBackend.cpp b/llvm/lib/Target/X86/X86AsmBackend.cpp
index 6a0b059..da5f5b1 100644
--- a/llvm/lib/Target/X86/X86AsmBackend.cpp
+++ b/llvm/lib/Target/X86/X86AsmBackend.cpp
@@ -40,7 +40,6 @@
   case X86::reloc_riprel_4byte_movq_load:
   case X86::reloc_signed_4byte:
   case X86::reloc_global_offset_table:
-  case X86::reloc_coff_secrel32:
   case FK_Data_4: return 2;
   case FK_PCRel_8:
   case FK_Data_8: return 3;
@@ -70,8 +69,7 @@
       { "reloc_riprel_4byte", 0, 4 * 8, MCFixupKindInfo::FKF_IsPCRel },
       { "reloc_riprel_4byte_movq_load", 0, 4 * 8, MCFixupKindInfo::FKF_IsPCRel},
       { "reloc_signed_4byte", 0, 4 * 8, 0},
-      { "reloc_global_offset_table", 0, 4 * 8, 0},
-      { "reloc_coff_secrel32", 0, 4 * 8, 0}
+      { "reloc_global_offset_table", 0, 4 * 8, 0}
     };
 
     if (Kind < FirstTargetFixupKind)
diff --git a/llvm/lib/Target/X86/X86FixupKinds.h b/llvm/lib/Target/X86/X86FixupKinds.h
index d6cb39a..17d242a 100644
--- a/llvm/lib/Target/X86/X86FixupKinds.h
+++ b/llvm/lib/Target/X86/X86FixupKinds.h
@@ -23,8 +23,6 @@
   reloc_global_offset_table,                 // 32-bit, relative to the start
                                              // of the instruction. Used only
                                              // for _GLOBAL_OFFSET_TABLE_.
-  reloc_coff_secrel32,                       // PE-COFF section relative 32
-                                             // (only valid for win32 COFF)
   // Marker
   LastTargetFixupKind,
   NumTargetFixupKinds = LastTargetFixupKind - FirstTargetFixupKind
diff --git a/llvm/lib/Target/X86/X86MCAsmInfo.cpp b/llvm/lib/Target/X86/X86MCAsmInfo.cpp
index 75bc1ed..6686214 100644
--- a/llvm/lib/Target/X86/X86MCAsmInfo.cpp
+++ b/llvm/lib/Target/X86/X86MCAsmInfo.cpp
@@ -113,7 +113,4 @@
   AssemblerDialect = AsmWriterFlavor;
 
   TextAlignFillValue = 0x90;
-  
-  // Debug Information
-  SupportsDebugInformation = true;
 }