+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
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 *,
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');
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++);
}
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;
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. */
((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)) { \
/* 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 \
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: \
/* 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)
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})
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})
#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
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
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
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;