diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7c6b4360b60d3ed292d2363a600abbbae2730cba..1879507fd7df1f81145cff834f3b5263f6f82d92 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2017-08-30  Richard Biener  <rguenther@suse.de>
+
+	* dwarf2out.c (add_dwarf_attr): Check we don't add duplicate
+	attributes.
+	(gen_subprogram_die): Add DW_AT_object_pointer only early.
+	(dwarf2out_early_global_decl): Only generate a DIE for the
+	abstract origin if it doesn't already exist or is a declaration DIE.
+	(resolve_addr): Do not add the linkage name twice when
+	generating a stub DIE for the DW_TAG_GNU_call_site target.
+
 2017-08-30  Richard Sandiford  <richard.sandiford@linaro.org>
 
 	* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin):
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 7120f4edf029d035a257e0e64c3e84618bc7f0a3..d76fef866fef55d462fa8497ea71dee3872cad2d 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -4129,7 +4129,7 @@ add_dwarf_attr (dw_die_ref die, dw_attr_node *attr)
       dw_attr_node *a;
       unsigned ix;
       FOR_EACH_VEC_SAFE_ELT (die->die_attr, ix, a)
-	gcc_assert (a->dw_attr != attr->dw_attr || a->dw_attr != DW_AT_inline);
+	gcc_assert (a->dw_attr != attr->dw_attr);
     }
 
   vec_safe_reserve (die->die_attr, 1);
@@ -22334,7 +22334,8 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
 	    {
 	      dw_die_ref parm_die = gen_decl_die (parm, NULL, NULL, subr_die);
 
-	      if (parm == DECL_ARGUMENTS (decl)
+	      if (early_dwarf
+		  && parm == DECL_ARGUMENTS (decl)
 		  && TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE
 		  && parm_die
 		  && (dwarf_version >= 3 || !dwarf_strict))
@@ -25479,10 +25480,16 @@ dwarf2out_early_global_decl (tree decl)
 	     with C++ constructor clones for example and makes
 	     dwarf2out_abstract_function happy which requires the early
 	     DIE of the abstract instance to be present.  */
-	  if (DECL_ABSTRACT_ORIGIN (decl))
+	  tree origin = DECL_ABSTRACT_ORIGIN (decl);
+	  dw_die_ref origin_die;
+	  if (origin != NULL
+	      /* Do not emit the DIE multiple times but make sure to
+	         process it fully here in case we just saw a declaration.  */
+	      && ((origin_die = lookup_decl_die (origin)) == NULL
+		  || is_declaration_die (origin_die)))
 	    {
-	      current_function_decl = DECL_ABSTRACT_ORIGIN (decl);
-	      dwarf2out_decl (DECL_ABSTRACT_ORIGIN (decl));
+	      current_function_decl = origin;
+	      dwarf2out_decl (origin);
 	    }
 
 	  current_function_decl = decl;
@@ -29047,7 +29054,7 @@ resolve_addr (dw_die_ref die)
 		    add_AT_flag (tdie, DW_AT_external, 1);
 		    add_AT_flag (tdie, DW_AT_declaration, 1);
 		    add_linkage_attr (tdie, tdecl);
-		    add_name_and_src_coords_attributes (tdie, tdecl);
+		    add_name_and_src_coords_attributes (tdie, tdecl, true);
 		    equate_decl_number_to_die (tdecl, tdie);
 		  }
 	      }
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ba864c5b0b4780852187a91223c0f6e7204b0f5a..24125f1886d687a64781e2443cb7da321d38d96c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2017-08-30  Richard Biener  <rguenther@suse.de>
+
+	* g++.dg/pr78112-2.C: Do not expect duplicate DW_AT_object_pointer.
+
 2017-08-29  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
 	PR target/82015
diff --git a/gcc/testsuite/g++.dg/pr78112-2.C b/gcc/testsuite/g++.dg/pr78112-2.C
index c174bd3121552a90050199a10f5cf1f8ea9a6d56..9870cccc22782561265f3eb4d6773072340720ab 100644
--- a/gcc/testsuite/g++.dg/pr78112-2.C
+++ b/gcc/testsuite/g++.dg/pr78112-2.C
@@ -2,7 +2,7 @@
 /* { dg-skip-if "No dwarf debug support" { hppa*-*-hpux* } } */
 /* { dg-options "-g -dA -gdwarf-4 -std=gnu++11" } */
 /* { dg-options "-g -dA -std=gnu++11 -gdwarf-4" } */
-/* { dg-final { scan-assembler-times DW_AT_object_pointer 18 } } */
+/* { dg-final { scan-assembler-times DW_AT_object_pointer 12 } } */
 
 void run (int *int_p, void(*func)(int *)) { func (int_p); }
 namespace foo {