Index: include/llvm/MC/MCStreamer.h
===================================================================
--- include/llvm/MC/MCStreamer.h	(revision 125426)
+++ include/llvm/MC/MCStreamer.h	(working copy)
@@ -197,6 +197,11 @@
     /// EndCOFFSymbolDef - Marks the end of the symbol definition.
     virtual void EndCOFFSymbolDef() = 0;
 
+    /// EmitCOFFSecRel32 - Emits a COFF section relative relocation.
+    ///
+    /// @param Symbol - Symbol the section relative realocation should point to.
+    virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) = 0;
+
     /// EmitELFSize - Emit an ELF .size directive.
     ///
     /// This corresponds to an assembler statement such as:
Index: lib/MC/MCAsmStreamer.cpp
===================================================================
--- lib/MC/MCAsmStreamer.cpp	(revision 125426)
+++ lib/MC/MCAsmStreamer.cpp	(working copy)
@@ -135,6 +135,7 @@
   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);
@@ -388,6 +389,11 @@
   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';
Index: lib/MC/MCELFStreamer.cpp
===================================================================
--- lib/MC/MCELFStreamer.cpp	(revision 125426)
+++ lib/MC/MCELFStreamer.cpp	(working copy)
@@ -108,6 +108,10 @@
     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);
Index: lib/MC/MCLoggingStreamer.cpp
===================================================================
--- lib/MC/MCLoggingStreamer.cpp	(revision 125426)
+++ lib/MC/MCLoggingStreamer.cpp	(working copy)
@@ -121,6 +121,11 @@
     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);
Index: lib/MC/MCMachOStreamer.cpp
===================================================================
--- lib/MC/MCMachOStreamer.cpp	(revision 125426)
+++ lib/MC/MCMachOStreamer.cpp	(working copy)
@@ -63,6 +63,9 @@
   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");
   }
Index: lib/MC/MCNullStreamer.cpp
===================================================================
--- lib/MC/MCNullStreamer.cpp	(revision 125426)
+++ lib/MC/MCNullStreamer.cpp	(working copy)
@@ -56,6 +56,7 @@
     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,
Index: lib/MC/MCPureStreamer.cpp
===================================================================
--- lib/MC/MCPureStreamer.cpp	(revision 125426)
+++ lib/MC/MCPureStreamer.cpp	(working copy)
@@ -83,6 +83,9 @@
   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");
   }
Index: lib/MC/WinCOFFStreamer.cpp
===================================================================
--- lib/MC/WinCOFFStreamer.cpp	(revision 125426)
+++ lib/MC/WinCOFFStreamer.cpp	(working copy)
@@ -31,6 +31,9 @@
 #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 {
@@ -59,6 +62,7 @@
   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);
@@ -290,6 +294,16 @@
   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");
 }
@@ -368,6 +382,10 @@
 
   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());
 
