diff --git a/gcc/dwarf2asm.c b/gcc/dwarf2asm.c
index ecc33d957c442d77eaab675726d1b88379f3b5b5..8e08d4d24d80c397b23f8bcf9af4c08aee8f254b 100644
--- a/gcc/dwarf2asm.c
+++ b/gcc/dwarf2asm.c
@@ -46,6 +46,52 @@ along with GCC; see the file COPYING3.  If not see
 void
 dw2_assemble_integer (int size, rtx x)
 {
+  if (size == 2 * DWARF2_ADDR_SIZE && !CONST_SCALAR_INT_P (x))
+    {
+      /* On 32-bit targets with -gdwarf64, DImode values with
+	 relocations usually result in assembler errors.  Assume
+	 all such values are positive and emit the relocation only
+	 in the least significant half.  */
+      const char *op = integer_asm_op (DWARF2_ADDR_SIZE, FALSE);
+      if (BYTES_BIG_ENDIAN)
+	{
+	  if (op)
+	    {
+	      fputs (op, asm_out_file);
+	      fprint_whex (asm_out_file, 0);
+	      fputs (", ", asm_out_file);
+	      output_addr_const (asm_out_file, x);
+	    }
+	  else
+	    {
+	      assemble_integer (const0_rtx, DWARF2_ADDR_SIZE,
+				BITS_PER_UNIT, 1);
+	      putc ('\n', asm_out_file);
+	      assemble_integer (x, DWARF2_ADDR_SIZE,
+				BITS_PER_UNIT, 1);
+	    }
+	}
+      else
+	{
+	  if (op)
+	    {
+	      fputs (op, asm_out_file);
+	      output_addr_const (asm_out_file, x);
+	      fputs (", ", asm_out_file);
+	      fprint_whex (asm_out_file, 0);
+	    }
+	  else
+	    {
+	      assemble_integer (x, DWARF2_ADDR_SIZE,
+				BITS_PER_UNIT, 1);
+	      putc ('\n', asm_out_file);
+	      assemble_integer (const0_rtx, DWARF2_ADDR_SIZE,
+				BITS_PER_UNIT, 1);
+	    }
+	}
+      return;
+    }
+
   const char *op = integer_asm_op (size, FALSE);
 
   if (op)