Index: gas/ChangeLog from Alexandre Oliva * dwarf2dbg.c (DWARF2_ADDR_SIZE): New macro. (dwarf2_finish): Use it. * doc/internals.texi (DWARF2_ADDR_SIZE): Document it. * config/tc-mips.h (DWARF2_ADDR_SIZE): Override. Index: gas/dwarf2dbg.c =================================================================== RCS file: /cvs/src/src/gas/dwarf2dbg.c,v retrieving revision 1.58 diff -u -p -r1.58 dwarf2dbg.c --- gas/dwarf2dbg.c 4 Dec 2002 01:03:05 -0000 1.58 +++ gas/dwarf2dbg.c 16 Dec 2002 22:11:10 -0000 @@ -44,9 +44,14 @@ #include "dwarf2dbg.h" #ifndef DWARF2_FORMAT -#define DWARF2_FORMAT() dwarf2_format_32bit +# define DWARF2_FORMAT() dwarf2_format_32bit #endif +#ifndef DWARF2_ADDR_SIZE +# define DWARF2_ADDR_SIZE(bfd) (bfd_arch_bits_per_address (bfd) / 8); +#endif + + #ifdef BFD_ASSEMBLER #include "subsegs.h" @@ -1341,7 +1346,7 @@ dwarf2_finish () return; /* Calculate the size of an address for the target machine. */ - sizeof_address = bfd_arch_bits_per_address (stdoutput) / 8; + sizeof_address = DWARF2_ADDR_SIZE (stdoutput); /* Create and switch to the line number section. */ line_seg = subseg_new (".debug_line", 0); Index: gas/config/tc-mips.h =================================================================== RCS file: /cvs/src/src/gas/config/tc-mips.h,v retrieving revision 1.20 diff -u -p -r1.20 tc-mips.h --- gas/config/tc-mips.h 30 Nov 2002 08:39:43 -0000 1.20 +++ gas/config/tc-mips.h 16 Dec 2002 22:11:10 -0000 @@ -185,4 +185,7 @@ extern void mips_enable_auto_align PARAM extern enum dwarf2_format mips_dwarf2_format PARAMS ((void)); #define DWARF2_FORMAT() mips_dwarf2_format () +#define DWARF2_ADDR_SIZE(bfd) \ + (DWARF2_FORMAT () == dwarf2_format_32bit ? 4 : 8) + #endif /* TC_MIPS */ Index: gas/doc/internals.texi =================================================================== RCS file: /cvs/src/src/gas/doc/internals.texi,v retrieving revision 1.32 diff -u -p -r1.32 internals.texi --- gas/doc/internals.texi 18 Nov 2002 21:08:54 -0000 1.32 +++ gas/doc/internals.texi 16 Dec 2002 22:11:12 -0000 @@ -1503,6 +1503,12 @@ This define only affects @code{.debug_in sections generated by the assembler. DWARF 2 sections generated by other tools will be unaffected by this setting. +@item DWARF2_ADDR_SIZE (@var{bfd}) +@cindex DWARF2_ADDR_SIZE +It should return the size of an address, as it should be represented in +debugging info. If you don't define this macro, the default definition uses +the number of bits per address, as defined in @var{bfd}, divided by 8. + @end table @node Object format backend