dwarf2asm.h (dw2_asm_output_offset): Add overload with extra offset argument.
authorRichard Biener <rguenther@suse.de>
Thu, 15 Sep 2016 10:22:32 +0000 (10:22 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 15 Sep 2016 10:22:32 +0000 (10:22 +0000)
2016-09-15  Richard Biener  <rguenther@suse.de>

* dwarf2asm.h (dw2_asm_output_offset): Add overload with
extra offset argument.
* dwarf2asm.c (dw2_asm_output_offset): Implement that.
* doc/tm.texi.in (ASM_OUTPUT_DWARF_OFFSET): Adjust documentation
to reflect new offset parameter.
* doc/tm.texi: Regenerate.
* config/darwin.h (ASM_OUTPUT_DWARF_OFFSET): Adjust.
* config/darwin-protos.h (darwin_asm_output_dwarf_delta): Add
offset argument.
(darwin_asm_output_dwarf_offset): Likewise.
* config/darwin.c (darwin_asm_output_dwarf_delta): Add offset
argument.
(darwin_asm_output_dwarf_offset): Pass offset argument through.
* config/ia64/ia64.h (ASM_OUTPUT_DWARF_OFFSET): Adjust.
* config/i386/cygmin.h (ASM_OUTPUT_DWARF_OFFSET): Likewise.

From-SVN: r240158

gcc/ChangeLog
gcc/config/darwin-protos.h
gcc/config/darwin.c
gcc/config/darwin.h
gcc/config/i386/cygming.h
gcc/config/ia64/ia64.h
gcc/doc/tm.texi
gcc/doc/tm.texi.in
gcc/dwarf2asm.c
gcc/dwarf2asm.h

index 22c5ffd..243b549 100644 (file)
@@ -1,3 +1,21 @@
+2016-09-15  Richard Biener  <rguenther@suse.de>
+
+       * dwarf2asm.h (dw2_asm_output_offset): Add overload with
+       extra offset argument.
+       * dwarf2asm.c (dw2_asm_output_offset): Implement that.
+       * doc/tm.texi.in (ASM_OUTPUT_DWARF_OFFSET): Adjust documentation
+       to reflect new offset parameter.
+       * doc/tm.texi: Regenerate.
+       * config/darwin.h (ASM_OUTPUT_DWARF_OFFSET): Adjust.
+       * config/darwin-protos.h (darwin_asm_output_dwarf_delta): Add
+       offset argument.
+       (darwin_asm_output_dwarf_offset): Likewise.
+       * config/darwin.c (darwin_asm_output_dwarf_delta): Add offset
+       argument.
+       (darwin_asm_output_dwarf_offset): Pass offset argument through.
+       * config/ia64/ia64.h (ASM_OUTPUT_DWARF_OFFSET): Adjust.
+       * config/i386/cygmin.h (ASM_OUTPUT_DWARF_OFFSET): Likewise.
+
 2016-09-15  Chung-Lin Tang  <cltang@codesourcery.com>
 
        PR fortran/72743
index 62c7259..7eb096b 100644 (file)
@@ -91,9 +91,9 @@ extern void darwin_globalize_label (FILE *, const char *);
 extern void darwin_assemble_visibility (tree, int);
 
 extern void darwin_asm_output_dwarf_delta (FILE *, int, const char *,
-                                          const char *);
+                                          const char *, HOST_WIDE_INT);
 extern void darwin_asm_output_dwarf_offset (FILE *, int, const char *,
-                                           section *);
+                                           HOST_WIDE_INT, section *);
 
 extern void darwin_asm_declare_object_name (FILE *, const char *, tree);
 extern void darwin_asm_declare_constant_name (FILE *, const char *,
index 0055d80..f8da959 100644 (file)
@@ -2790,7 +2790,8 @@ static int darwin_dwarf_label_counter;
 
 void
 darwin_asm_output_dwarf_delta (FILE *file, int size,
-                              const char *lab1, const char *lab2)
+                              const char *lab1, const char *lab2,
+                              HOST_WIDE_INT offset)
 {
   int islocaldiff = (lab1[0] == '*' && lab1[1] == 'L'
                     && lab2[0] == '*' && lab2[1] == 'L');
@@ -2804,6 +2805,8 @@ darwin_asm_output_dwarf_delta (FILE *file, int size,
   assemble_name_raw (file, lab1);
   fprintf (file, "-");
   assemble_name_raw (file, lab2);
+  if (offset != 0)
+    fprintf (file, "+" HOST_WIDE_INT_PRINT_DEC, offset);
   if (islocaldiff)
     fprintf (file, "\n\t%s L$set$%d", directive, darwin_dwarf_label_counter++);
 }
@@ -2815,7 +2818,7 @@ darwin_asm_output_dwarf_delta (FILE *file, int size,
 
 void
 darwin_asm_output_dwarf_offset (FILE *file, int size, const char * lab,
-                               section *base)
+                               HOST_WIDE_INT offset, section *base)
 {
   char sname[64];
   int namelen;
@@ -2826,7 +2829,7 @@ darwin_asm_output_dwarf_offset (FILE *file, int size, const char * lab,
 
   namelen = strchr (base->named.name + 8, ',') - (base->named.name + 8);
   sprintf (sname, "*Lsection%.*s", namelen, base->named.name + 8);
-  darwin_asm_output_dwarf_delta (file, size, lab, sname);
+  darwin_asm_output_dwarf_delta (file, size, lab, sname, offset);
 }
 
 /* Called from the within the TARGET_ASM_FILE_START for each target.  */
index 944548a..3782eb3 100644 (file)
@@ -835,10 +835,10 @@ enum machopic_addr_class {
      ((CODE) == 1 || (GLOBAL) == 0) ? DW_EH_PE_pcrel : DW_EH_PE_absptr)
 
 #define ASM_OUTPUT_DWARF_DELTA(FILE,SIZE,LABEL1,LABEL2)  \
-  darwin_asm_output_dwarf_delta (FILE, SIZE, LABEL1, LABEL2)
+  darwin_asm_output_dwarf_delta (FILE, SIZE, LABEL1, LABEL2, 0)
 
-#define ASM_OUTPUT_DWARF_OFFSET(FILE,SIZE,LABEL,BASE)  \
-  darwin_asm_output_dwarf_offset (FILE, SIZE, LABEL, BASE)
+#define ASM_OUTPUT_DWARF_OFFSET(FILE,SIZE,LABEL,OFFSET,BASE)  \
+  darwin_asm_output_dwarf_offset (FILE, SIZE, LABEL, OFFSET, BASE)
 
 #define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(ASM_OUT_FILE, ENCODING, SIZE, ADDR, DONE)    \
       if (ENCODING == ASM_PREFERRED_EH_DATA_FORMAT (2, 1)) {                           \
index d6c2254..228d6a2 100644 (file)
@@ -102,13 +102,15 @@ along with GCC; see the file COPYING3.  If not see
 /* Use section relative relocations for debugging offsets.  Unlike
    other targets that fake this by putting the section VMA at 0, PE
    won't allow it.  */
-#define ASM_OUTPUT_DWARF_OFFSET(FILE, SIZE, LABEL, SECTION)    \
+#define ASM_OUTPUT_DWARF_OFFSET(FILE, SIZE, LABEL, OFFSET, SECTION) \
   do {                                                         \
     switch (SIZE)                                              \
       {                                                                \
       case 4:                                                  \
        fputs ("\t.secrel32\t", FILE);                          \
        assemble_name (FILE, LABEL);                            \
+       if (offset != 0)                                        \
+         fprintf (FILE, "+" HOST_WIDE_INT_PRINT_DEC, offset)   \
        break;                                                  \
       case 8:                                                  \
        /* This is a hack.  There is no 64-bit section relative \
@@ -118,6 +120,8 @@ along with GCC; see the file COPYING3.  If not see
           Fake the 64-bit offset by zero-extending it.  */     \
        fputs ("\t.secrel32\t", FILE);                          \
        assemble_name (FILE, LABEL);                            \
+       if (offset != 0)                                        \
+         fprintf (FILE, "+" HOST_WIDE_INT_PRINT_DEC, offset)   \
        fputs ("\n\t.long\t0", FILE);                           \
        break;                                                  \
       default:                                                 \
index daf717b..aab2d7a 100644 (file)
@@ -1581,11 +1581,13 @@ do {                                                                    \
 /* Use section-relative relocations for debugging offsets.  Unlike other
    targets that fake this by putting the section VMA at 0, IA-64 has
    proper relocations for them.  */
-#define ASM_OUTPUT_DWARF_OFFSET(FILE, SIZE, LABEL, SECTION)    \
+#define ASM_OUTPUT_DWARF_OFFSET(FILE, SIZE, LABEL, OFFSET, SECTION) \
   do {                                                         \
     fputs (integer_asm_op (SIZE, FALSE), FILE);                        \
     fputs ("@secrel(", FILE);                                  \
     assemble_name (FILE, LABEL);                               \
+    if (offset != 0)                                           \
+      fprintf (FILE, "+" HOST_WIDE_INT_PRINT_DEC, OFFSET);     \
     fputc (')', FILE);                                         \
   } while (0)
 
index 0ca00d2..8d533d5 100644 (file)
@@ -9718,10 +9718,11 @@ between the two given labels in system defined units, e.g. instruction
 slots on IA64 VMS, using an integer of the given size.
 @end defmac
 
-@defmac ASM_OUTPUT_DWARF_OFFSET (@var{stream}, @var{size}, @var{label}, @var{section})
+@defmac ASM_OUTPUT_DWARF_OFFSET (@var{stream}, @var{size}, @var{label}, @var{offset}, @var{section})
 A C statement to issue assembly directives that create a
-section-relative reference to the given @var{label}, using an integer of the
-given @var{size}.  The label is known to be defined in the given @var{section}.
+section-relative reference to the given @var{label} plus @var{offset}, using
+an integer of the given @var{size}.  The label is known to be defined in the
+given @var{section}.
 @end defmac
 
 @defmac ASM_OUTPUT_DWARF_PCREL (@var{stream}, @var{size}, @var{label})
index a5714d1..b148238 100644 (file)
@@ -7059,10 +7059,11 @@ between the two given labels in system defined units, e.g. instruction
 slots on IA64 VMS, using an integer of the given size.
 @end defmac
 
-@defmac ASM_OUTPUT_DWARF_OFFSET (@var{stream}, @var{size}, @var{label}, @var{section})
+@defmac ASM_OUTPUT_DWARF_OFFSET (@var{stream}, @var{size}, @var{label}, @var{offset}, @var{section})
 A C statement to issue assembly directives that create a
-section-relative reference to the given @var{label}, using an integer of the
-given @var{size}.  The label is known to be defined in the given @var{section}.
+section-relative reference to the given @var{label} plus @var{offset}, using
+an integer of the given @var{size}.  The label is known to be defined in the
+given @var{section}.
 @end defmac
 
 @defmac ASM_OUTPUT_DWARF_PCREL (@var{stream}, @var{size}, @var{label})
index ae81445..cad5509 100644 (file)
@@ -30,6 +30,8 @@ along with GCC; see the file COPYING3.  If not see
 #include "output.h"
 #include "dwarf2asm.h"
 #include "dwarf2.h"
+#include "function.h"
+#include "emit-rtl.h"
 
 #ifndef XCOFF_DEBUGGING_INFO
 #define XCOFF_DEBUGGING_INFO 0
@@ -191,7 +193,7 @@ dw2_asm_output_offset (int size, const char *label,
   va_start (ap, comment);
 
 #ifdef ASM_OUTPUT_DWARF_OFFSET
-  ASM_OUTPUT_DWARF_OFFSET (asm_out_file, size, label, base);
+  ASM_OUTPUT_DWARF_OFFSET (asm_out_file, size, label, 0, base);
 #else
   dw2_assemble_integer (size, gen_rtx_SYMBOL_REF (Pmode, label));
 #endif
@@ -206,6 +208,33 @@ dw2_asm_output_offset (int size, const char *label,
   va_end (ap);
 }
 
+void
+dw2_asm_output_offset (int size, const char *label, HOST_WIDE_INT offset,
+                      section *base ATTRIBUTE_UNUSED,
+                      const char *comment, ...)
+{
+  va_list ap;
+
+  va_start (ap, comment);
+
+#ifdef ASM_OUTPUT_DWARF_OFFSET
+  ASM_OUTPUT_DWARF_OFFSET (asm_out_file, size, label, offset, base);
+#else
+  dw2_assemble_integer (size, gen_rtx_PLUS (Pmode,
+                                           gen_rtx_SYMBOL_REF (Pmode, label),
+                                           gen_int_mode (offset, Pmode)));
+#endif
+
+  if (flag_debug_asm && comment)
+    {
+      fprintf (asm_out_file, "\t%s ", ASM_COMMENT_START);
+      vfprintf (asm_out_file, comment, ap);
+    }
+  fputc ('\n', asm_out_file);
+
+  va_end (ap);
+}
+
 #if 0
 
 /* Output a self-relative reference to a label, possibly in a
index d468fc8..42064d3 100644 (file)
@@ -40,6 +40,10 @@ extern void dw2_asm_output_offset (int, const char *, section *,
                                   const char *, ...)
      ATTRIBUTE_NULL_PRINTF_4;
 
+extern void dw2_asm_output_offset (int, const char *, HOST_WIDE_INT,
+                                  section *, const char *, ...)
+     ATTRIBUTE_NULL_PRINTF_5;
+
 extern void dw2_asm_output_addr (int, const char *, const char *, ...)
      ATTRIBUTE_NULL_PRINTF_3;