* dwarf2dbg.c (generic_dwarf2_emit_offset): New.

(TC_DWARF2_EMIT_OFFSET): Provide default.
        (out_debug_aranges, out_debug_info): Use it.
        * config/tc-ia64.c (ia64_dwarf2_emit_offset): New.
        (ia64_cons_fix_new): Move FUNC_DTP_RELATIVE handling ...
        (ia64_gen_real_reloc_type): ... here.
        * config/tc-ia64.h (TC_DWARF2_EMIT_OFFSET): New.
This commit is contained in:
Richard Henderson
2003-03-11 22:00:33 +00:00
parent d8cbbf95b2
commit 6174d9c85e
4 changed files with 57 additions and 24 deletions

View File

@ -1,3 +1,13 @@
2003-03-11 Steve Ellcey <sje@cup.hp.com>
* dwarf2dbg.c (generic_dwarf2_emit_offset): New.
(TC_DWARF2_EMIT_OFFSET): Provide default.
(out_debug_aranges, out_debug_info): Use it.
* config/tc-ia64.c (ia64_dwarf2_emit_offset): New.
(ia64_cons_fix_new): Move FUNC_DTP_RELATIVE handling ...
(ia64_gen_real_reloc_type): ... here.
* config/tc-ia64.h (TC_DWARF2_EMIT_OFFSET): New.
2003-03-09 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de> 2003-03-09 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
* config/tc-mips.c (s_mips_end): Remove !BFD_ASSEMBLER case. * config/tc-mips.c (s_mips_end): Remove !BFD_ASSEMBLER case.

View File

@ -10033,6 +10033,20 @@ ia64_pcrel_from_section (fix, sec)
return off; return off;
} }
/* Used to emit section-relative relocs for the dwarf2 debug data. */
void
ia64_dwarf2_emit_offset (symbolS *symbol, unsigned int size)
{
expressionS expr;
expr.X_op = O_pseudo_fixup;
expr.X_op_symbol = pseudo_func[FUNC_SEC_RELATIVE].u.sym;
expr.X_add_number = 0;
expr.X_add_symbol = symbol;
emit_expr (&expr, size);
}
/* This is called whenever some data item (not an instruction) needs a /* This is called whenever some data item (not an instruction) needs a
fixup. We pick the right reloc code depending on the byteorder fixup. We pick the right reloc code depending on the byteorder
currently in effect. */ currently in effect. */
@ -10074,16 +10088,6 @@ ia64_cons_fix_new (f, where, nbytes, exp)
exp->X_op = O_symbol; exp->X_op = O_symbol;
break; break;
} }
else if (exp->X_op == O_pseudo_fixup
&& exp->X_op_symbol
&& S_GET_VALUE (exp->X_op_symbol) == FUNC_DTP_RELATIVE)
{
if (target_big_endian)
code = BFD_RELOC_IA64_DTPREL64MSB;
else
code = BFD_RELOC_IA64_DTPREL64LSB;
break;
}
else else
{ {
if (target_big_endian) if (target_big_endian)
@ -10102,7 +10106,6 @@ ia64_cons_fix_new (f, where, nbytes, exp)
code = BFD_RELOC_IA64_IPLTMSB; code = BFD_RELOC_IA64_IPLTMSB;
else else
code = BFD_RELOC_IA64_IPLTLSB; code = BFD_RELOC_IA64_IPLTLSB;
exp->X_op = O_symbol; exp->X_op = O_symbol;
break; break;
} }
@ -10113,11 +10116,12 @@ ia64_cons_fix_new (f, where, nbytes, exp)
ignore_rest_of_line (); ignore_rest_of_line ();
return; return;
} }
if (exp->X_op == O_pseudo_fixup) if (exp->X_op == O_pseudo_fixup)
{ {
/* ??? */
exp->X_op = O_symbol; exp->X_op = O_symbol;
code = ia64_gen_real_reloc_type (exp->X_op_symbol, code); code = ia64_gen_real_reloc_type (exp->X_op_symbol, code);
/* ??? If code unchanged, unsupported. */
} }
fix = fix_new_exp (f, where, nbytes, exp, 0, code); fix = fix_new_exp (f, where, nbytes, exp, 0, code);
@ -10293,6 +10297,10 @@ ia64_gen_real_reloc_type (sym, r_type)
case FUNC_DTP_RELATIVE: case FUNC_DTP_RELATIVE:
switch (r_type) switch (r_type)
{ {
case BFD_RELOC_IA64_DIR64MSB:
new = BFD_RELOC_IA64_DTPREL64MSB; break;
case BFD_RELOC_IA64_DIR64LSB:
new = BFD_RELOC_IA64_DTPREL64LSB; break;
case BFD_RELOC_IA64_IMM14: case BFD_RELOC_IA64_IMM14:
new = BFD_RELOC_IA64_DTPREL14; break; new = BFD_RELOC_IA64_DTPREL14; break;
case BFD_RELOC_IA64_IMM22: case BFD_RELOC_IA64_IMM22:
@ -10320,6 +10328,7 @@ ia64_gen_real_reloc_type (sym, r_type)
default: default:
abort (); abort ();
} }
/* Hmmmm. Should this ever occur? */ /* Hmmmm. Should this ever occur? */
if (new) if (new)
return new; return new;

View File

@ -89,6 +89,7 @@ extern long ia64_pcrel_from_section PARAMS ((struct fix *fix, segT sec));
extern void ia64_md_do_align PARAMS ((int, const char *, int, int)); extern void ia64_md_do_align PARAMS ((int, const char *, int, int));
extern void ia64_handle_align PARAMS ((fragS *f)); extern void ia64_handle_align PARAMS ((fragS *f));
extern void ia64_after_parse_args PARAMS ((void)); extern void ia64_after_parse_args PARAMS ((void));
extern void ia64_dwarf2_emit_offset PARAMS ((symbolS *, unsigned int));
#define md_end() ia64_end_of_source () #define md_end() ia64_end_of_source ()
#define md_start_line_hook() ia64_start_line () #define md_start_line_hook() ia64_start_line ()
@ -119,6 +120,7 @@ extern void ia64_after_parse_args PARAMS ((void));
#define HANDLE_ALIGN(f) ia64_handle_align (f) #define HANDLE_ALIGN(f) ia64_handle_align (f)
#define md_elf_section_type(str,len) ia64_elf_section_type (str, len) #define md_elf_section_type(str,len) ia64_elf_section_type (str, len)
#define md_after_parse_args() ia64_after_parse_args () #define md_after_parse_args() ia64_after_parse_args ()
#define TC_DWARF2_EMIT_OFFSET ia64_dwarf2_emit_offset
#define MAX_MEM_FOR_RS_ALIGN_CODE (15 + 16) #define MAX_MEM_FOR_RS_ALIGN_CODE (15 + 16)

View File

@ -52,6 +52,9 @@
# define DWARF2_ADDR_SIZE(bfd) (bfd_arch_bits_per_address (bfd) / 8); # define DWARF2_ADDR_SIZE(bfd) (bfd_arch_bits_per_address (bfd) / 8);
#endif #endif
#ifndef TC_DWARF2_EMIT_OFFSET
# define TC_DWARF2_EMIT_OFFSET generic_dwarf2_emit_offset
#endif
#ifdef BFD_ASSEMBLER #ifdef BFD_ASSEMBLER
@ -160,6 +163,7 @@ static char const fake_label_name[] = ".L0\001";
/* The size of an address on the target. */ /* The size of an address on the target. */
static unsigned int sizeof_address; static unsigned int sizeof_address;
static void generic_dwarf2_emit_offset PARAMS((symbolS *, unsigned int));
static struct line_subseg *get_line_subseg PARAMS ((segT, subsegT)); static struct line_subseg *get_line_subseg PARAMS ((segT, subsegT));
static unsigned int get_filenum PARAMS ((const char *, unsigned int)); static unsigned int get_filenum PARAMS ((const char *, unsigned int));
static struct frag *first_frag_for_seg PARAMS ((segT)); static struct frag *first_frag_for_seg PARAMS ((segT));
@ -186,6 +190,21 @@ static void out_debug_aranges PARAMS ((segT, segT));
static void out_debug_abbrev PARAMS ((segT)); static void out_debug_abbrev PARAMS ((segT));
static void out_debug_info PARAMS ((segT, segT, segT)); static void out_debug_info PARAMS ((segT, segT, segT));
/* Create an offset to .dwarf2_*. */
static void
generic_dwarf2_emit_offset (symbol, size)
symbolS *symbol;
unsigned int size;
{
expressionS expr;
expr.X_op = O_symbol;
expr.X_add_symbol = symbol;
expr.X_add_number = 0;
emit_expr (&expr, size);
}
/* Find or create an entry for SEG+SUBSEG in ALL_SEGS. */ /* Find or create an entry for SEG+SUBSEG in ALL_SEGS. */
static struct line_subseg * static struct line_subseg *
@ -1209,10 +1228,8 @@ out_debug_aranges (aranges_seg, info_seg)
out_two (2); out_two (2);
/* Offset to .debug_info. */ /* Offset to .debug_info. */
expr.X_op = O_symbol; /* ??? sizeof_offset */
expr.X_add_symbol = section_symbol (info_seg); TC_DWARF2_EMIT_OFFSET (section_symbol (info_seg), 4);
expr.X_add_number = 0;
emit_expr (&expr, 4);
/* Size of an address (offset portion). */ /* Size of an address (offset portion). */
out_byte (addr_size); out_byte (addr_size);
@ -1339,10 +1356,7 @@ out_debug_info (info_seg, abbrev_seg, line_seg)
out_two (2); out_two (2);
/* .debug_abbrev offset */ /* .debug_abbrev offset */
expr.X_op = O_symbol; TC_DWARF2_EMIT_OFFSET (section_symbol (abbrev_seg), sizeof_offset);
expr.X_add_symbol = section_symbol (abbrev_seg);
expr.X_add_number = 0;
emit_expr (&expr, sizeof_offset);
/* Target address size. */ /* Target address size. */
out_byte (sizeof_address); out_byte (sizeof_address);
@ -1351,10 +1365,8 @@ out_debug_info (info_seg, abbrev_seg, line_seg)
out_uleb128 (1); out_uleb128 (1);
/* DW_AT_stmt_list */ /* DW_AT_stmt_list */
expr.X_op = O_symbol; /* ??? sizeof_offset */
expr.X_add_symbol = section_symbol (line_seg); TC_DWARF2_EMIT_OFFSET (section_symbol (line_seg), 4);
expr.X_add_number = 0;
emit_expr (&expr, 4);
/* These two attributes may only be emitted if all of the code is /* These two attributes may only be emitted if all of the code is
contiguous. Multiple sections are not that. */ contiguous. Multiple sections are not that. */