From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cagney To: BINUTILS Patches Cc: GDB Patches Subject: [rfc] For mips, sign-extended ecoff offsets Date: Mon, 19 Jun 2000 05:14:00 -0000 Message-id: <394E0E73.E24DAB25@cygnus.com> X-SW-Source: 2000-06/msg00363.html Hello, The attatched patch changes the MIPS ELF32 backend so that it is more likely to return a sign-extended offset. At present the ELF backend returns sign-extended symbol table values but not sign extended debug information. For instance, an asymbol might contain 0xfffffffa0100124 yet the value returned by ecoff_swap_sym_in() is 0xa0100124. Preliminary tests with GDB suggest this improves things significantly. Next question is, what damage is this likely to do to BFD and the linker. Andrew PS: This will hurt GDB more than it can hurt BFD :-) Mon Jun 19 20:53:14 2000 Andrew Cagney * ecoffswap.h (ecoff_get_off, ecoff_put_off): Add ECOFF_SIGNED_32 and ECOF_SIGNED_64 to list ways to extract an offset. * elf64-mips.c (ECOFF_SIGNED_64): Define instead of ECOFF_64. * elf32-mips.c (ECOFF_SIGNED_32): Define instead of ECOFF_32. Index: ecoffswap.h =================================================================== RCS file: /cvs/cvsfiles/devo/bfd/ecoffswap.h,v retrieving revision 1.19 diff -p -r1.19 ecoffswap.h *** ecoffswap.h 1996/03/12 22:41:13 1.19 --- ecoffswap.h 2000/06/19 11:56:25 *************** Foundation, Inc., 59 Temple Place - Suit *** 27,36 **** on them in gdb by naming the including source file; e.g., 'coff-mips.c':ecoff_swap_hdr_in. ! Before including this header file, one of ECOFF_32 or ECOFF_64 must ! be defined. These are checked when swapping information that ! depends upon the target size. This code works for 32 bit and 64 ! bit ECOFF, but may need to be generalized in the future. Some header file which defines the external forms of these structures must also be included before including this header file. --- 27,37 ---- on them in gdb by naming the including source file; e.g., 'coff-mips.c':ecoff_swap_hdr_in. ! Before including this header file, one of ECOFF_32, ECOFF_64, ! ECOF_SIGNED_32 or ECOFF_SIGNED_64 must be defined. These are ! checked when swapping information that depends upon the target ! size. This code works for 32 bit and 64 bit ECOFF, but may need to ! be generalized in the future. Some header file which defines the external forms of these structures must also be included before including this header file. *************** Foundation, Inc., 59 Temple Place - Suit *** 49,54 **** --- 50,63 ---- #ifdef ECOFF_64 #define ecoff_get_off bfd_h_get_64 #define ecoff_put_off bfd_h_put_64 + #endif + #ifdef ECOFF_SIGNED_32 + #define ecoff_get_off bfd_h_get_signed_32 + #define ecoff_put_off bfd_h_put_signed_32 + #endif + #ifdef ECOFF_SIGNED_64 + #define ecoff_get_off bfd_h_get_signed_32 + #define ecoff_put_off bfd_h_put_signed_32 #endif /* ECOFF auxiliary information swapping routines. These are the same Index: elf32-mips.c =================================================================== RCS file: /cvs/cvsfiles/devo/bfd/elf32-mips.c,v retrieving revision 1.176 diff -p -r1.176 elf32-mips.c *** elf32-mips.c 2000/05/29 16:45:57 1.176 --- elf32-mips.c 2000/06/19 11:56:44 *************** Foundation, Inc., 59 Temple Place - Suit *** 40,46 **** #include "coff/internal.h" #include "coff/ecoff.h" #include "coff/mips.h" ! #define ECOFF_32 #include "ecoffswap.h" /* This structure is used to hold .got information when linking. It --- 40,46 ---- #include "coff/internal.h" #include "coff/ecoff.h" #include "coff/mips.h" ! #define ECOFF_SIGNED_32 #include "ecoffswap.h" /* This structure is used to hold .got information when linking. It Index: elf64-mips.c =================================================================== RCS file: /cvs/cvsfiles/devo/bfd/elf64-mips.c,v retrieving revision 1.18 diff -p -r1.18 elf64-mips.c *** elf64-mips.c 1999/12/10 10:49:53 1.18 --- elf64-mips.c 2000/06/19 11:56:46 *************** Foundation, Inc., 59 Temple Place - Suit *** 45,51 **** #include "coff/ecoff.h" /* The 64 bit versions of the mdebug data structures are in alpha.h. */ #include "coff/alpha.h" ! #define ECOFF_64 #include "ecoffswap.h" static void mips_elf64_swap_reloc_in --- 45,51 ---- #include "coff/ecoff.h" /* The 64 bit versions of the mdebug data structures are in alpha.h. */ #include "coff/alpha.h" ! #define ECOFF_SIGNED_64 #include "ecoffswap.h" static void mips_elf64_swap_reloc_in