diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 22c5ffdd628..243b5496065 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,21 @@ +2016-09-15 Richard Biener + + * 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 PR fortran/72743 diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h index 62c72596461..7eb096b4577 100644 --- a/gcc/config/darwin-protos.h +++ b/gcc/config/darwin-protos.h @@ -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 *, diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 0055d805441..f8da9591be8 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -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. */ diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index 944548a7416..3782eb34047 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -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)) { \ diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h index d6c2254b800..228d6a2e1c2 100644 --- a/gcc/config/i386/cygming.h +++ b/gcc/config/i386/cygming.h @@ -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: \ diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h index daf717b949d..aab2d7a4c01 100644 --- a/gcc/config/ia64/ia64.h +++ b/gcc/config/ia64/ia64.h @@ -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) diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 0ca00d2548d..8d533d53083 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -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}) diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index a5714d10583..b1482381c9a 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -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}) diff --git a/gcc/dwarf2asm.c b/gcc/dwarf2asm.c index ae81445dc84..cad550916d4 100644 --- a/gcc/dwarf2asm.c +++ b/gcc/dwarf2asm.c @@ -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 diff --git a/gcc/dwarf2asm.h b/gcc/dwarf2asm.h index d468fc8f346..42064d34d22 100644 --- a/gcc/dwarf2asm.h +++ b/gcc/dwarf2asm.h @@ -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;