Index: lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -191,7 +191,7 @@
     }
     // Add the linkage name.
     StringRef LinkageName = GV.getLinkageName();
-    if (!LinkageName.empty())
+    if (DD->emitLinkageNames() && !LinkageName.empty())
       // From DWARF4: DIEs to which DW_AT_linkage_name may apply include:
       // TAG_common_block, TAG_constant, TAG_entry_point, TAG_subprogram and
       // TAG_variable.
@@ -230,7 +230,8 @@
 
     // If the linkage name is different than the name, go ahead and output
     // that as well into the name table.
-    if (GV.getLinkageName() != "" && GV.getName() != GV.getLinkageName())
+    if (DD->emitLinkageNames() &&
+        GV.getLinkageName() != "" && GV.getName() != GV.getLinkageName())
       DD->addAccelName(GV.getLinkageName(), *ResultDIE);
   }
 
Index: lib/CodeGen/AsmPrinter/DwarfDebug.h
===================================================================
--- lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -289,6 +289,10 @@
   // Whether or not to use AT_ranges for compilation units.
   bool HasCURanges;
 
+  // Whether we emit DWARF linkage name entries (DW_AT_MIPS_linkage_name and 
+  // DW_AT_linkage_name)
+  bool EmitLinkageNames;
+
   // Whether we emitted a function into a section other than the default
   // text.
   bool UsedNonDefaultText;
@@ -512,6 +516,8 @@
     LabelsAfterInsn.insert(std::make_pair(MI, nullptr));
   }
 
+  void parseDwarfGenMetadata(const Module *M);
+
 public:
   //===--------------------------------------------------------------------===//
   // Main entry points.
@@ -573,6 +579,10 @@
   /// split dwarf proposal support.
   bool useSplitDwarf() const { return HasSplitDwarf; }
 
+  /// \brief Returns whether or not to emit DW_AT_MIPS_linkage_name and 
+  /// DW_linkage_name entries.
+  bool emitLinkageNames() const { return EmitLinkageNames; }
+
   /// Returns the Dwarf Version.
   unsigned getDwarfVersion() const { return DwarfVersion; }
 
Index: lib/CodeGen/AsmPrinter/DwarfDebug.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -208,6 +208,9 @@
   else
     HasDwarfPubSections = DwarfPubSections == Enable;
 
+  EmitLinkageNames = true;
+  parseDwarfGenMetadata(M);
+
   unsigned DwarfVersionNumber = Asm->TM.Options.MCOptions.DwarfVersion;
   DwarfVersion = DwarfVersionNumber ? DwarfVersionNumber
                                     : MMI->getModule()->getDwarfVersion();
@@ -282,7 +285,8 @@
 
   // If the linkage name is different than the name, go ahead and output
   // that as well into the name table.
-  if (SP.getLinkageName() != "" && SP.getName() != SP.getLinkageName())
+  if (emitLinkageNames() && 
+      SP.getLinkageName() != "" && SP.getName() != SP.getLinkageName())
     addAccelName(SP.getLinkageName(), Die);
 
   // If this is an Objective-C selector name add it to the ObjC accelerator
@@ -2313,3 +2317,20 @@
   AccelTypes.AddName(Name, InfoHolder.getStringPool().getSymbol(*Asm, Name),
                      &Die);
 }
+
+
+// Parse module metadata to deal with options relevant to DWARF generation.
+// The only supported flag is "suppress-linkage-names", anything else is
+// ignored.
+void DwarfDebug::parseDwarfGenMetadata(const Module *M) {
+  Value *Val = M->getModuleFlag("Dwarf Gen Flags");
+  if (Val == nullptr)
+    return;
+  MDNode *DwarfGenFlags = cast<MDNode>(Val);
+  for (unsigned i = 0, e = DwarfGenFlags->getNumOperands(); i != e; ++i) {
+    if (MDString *MDFlag = dyn_cast<MDString>(DwarfGenFlags->getOperand(i))) {
+      if (MDFlag->getString() == "suppress-linkage-names")
+        EmitLinkageNames = false;
+    }
+  }
+}
Index: lib/CodeGen/AsmPrinter/DwarfUnit.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -1430,7 +1430,7 @@
   assert(((LinkageName.empty() || DeclLinkageName.empty()) ||
           LinkageName == DeclLinkageName) &&
          "decl has a linkage name and it is different");
-  if (!LinkageName.empty() && DeclLinkageName.empty())
+  if (DD->emitLinkageNames() && !LinkageName.empty() && DeclLinkageName.empty())
     addString(SPDie, dwarf::DW_AT_MIPS_linkage_name,
               GlobalValue::getRealLinkageName(LinkageName));
 
Index: test/DebugInfo/suppress-linkage-entries.ll
===================================================================
--- test/DebugInfo/suppress-linkage-entries.ll
+++ test/DebugInfo/suppress-linkage-entries.ll
@@ -0,0 +1,55 @@
+; REQUIRES: object-emission
+
+; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump - | FileCheck %s
+
+; The test checks whether the DWARF linkage name entries are suppressed 
+; in response to the flag "suppress-linkage-names" which is conveyed
+; by the module flags "Dwarf Gen Flags".
+
+; 
+; The IR was generated with clang -g from the source below with a modified
+; cfe that generates the module flag "Dwarf Gen Flags".
+
+; namespace bar {
+;   int i;
+; }
+; 
+; void foo()
+; {
+; }
+
+; CHECK-NOT: DW_AT_MIPS_linkage_name
+; CHECK-NOT: DW_AT_linkage_name
+
+@_ZN3bar1iE = global i32 0, align 4
+
+; Function Attrs: nounwind uwtable
+define void @_Z3foov() #0 {
+entry:
+  ret void, !dbg !17
+}
+
+attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!12, !13, !14}
+!llvm.ident = !{!16}
+
+!0 = metadata !{i32 786449, metadata !1, i32 4, metadata !"clang version 3.6.0 (218613)", i1 false, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, metadata !8, metadata !2, metadata !"", i32 1} ; [ DW_TAG_compile_unit ] [/home/user/test/test.cpp] [DW_LANG_C_plus_plus]
+!1 = metadata !{metadata !"test.cpp", metadata !"/home/user/test"}
+!2 = metadata !{}
+!3 = metadata !{metadata !4}
+!4 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"foo", metadata !"foo", metadata !"_Z3foov", i32 5, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void ()* @_Z3foov, null, null, metadata !2, i32 6} ; [ DW_TAG_subprogram ] [line 5] [def] [scope 6] [foo]
+!5 = metadata !{i32 786473, metadata !1}          ; [ DW_TAG_file_type ] [/home/user/test/test.cpp]
+!6 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !7, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
+!7 = metadata !{null}
+!8 = metadata !{metadata !9}
+!9 = metadata !{i32 786484, i32 0, metadata !10, metadata !"i", metadata !"i", metadata !"_ZN3bar1iE", metadata !5, i32 2, metadata !11, i32 0, i32 1, i32* @_ZN3bar1iE, null} ; [ DW_TAG_variable ] [i] [line 2] [def]
+!10 = metadata !{i32 786489, metadata !1, null, metadata !"bar", i32 1} ; [ DW_TAG_namespace ] [bar] [line 1]
+!11 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
+!12 = metadata !{i32 2, metadata !"Dwarf Version", i32 4}
+!13 = metadata !{i32 2, metadata !"Debug Info Version", i32 1}
+!14 = metadata !{i32 6, metadata !"Dwarf Gen Flags", metadata !15}
+!15 = metadata !{metadata !"suppress-linkage-names"}
+!16 = metadata !{metadata !"clang version 3.6.0 (218613)"}
+!17 = metadata !{i32 7, i32 1, metadata !4, null}