[rfa] move bfd_elf_get_arch_size() et.al. to bfd.c:bfd_get...
Andrew Cagney
ac131313@cygnus.com
Mon Jul 17 20:33:00 GMT 2000
More information about the Binutils mailing list
Mon Jul 17 20:33:00 GMT 2000
- Previous message (by thread): [rfa] move bfd_elf_get_arch_size() et.al. to bfd.c:bfd_get...
- Next message (by thread): [rfa] move bfd_elf_get_arch_size() et.al. to bfd.c:bfd_get...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
And the patch.... Andrew Cagney wrote: > > Hello, > > The attatched patch moves / renames the functions: > > bfd_elf_get_arch_size() > -> bfd_get_arch_size() > > and > bfd_elf_get_sign_extends_vma() > -> bfd_get_sign_extends_vma() > > from elf.c to bfd.c. GDB was assuming that only elf targets would need > dwarf2 and shlib support :-( > > Ok? > > Andrew Tue Jul 18 13:11:54 2000 Andrew Cagney <cagney@b1.cygnus.com> * elf.c (bfd_elf_get_sign_extend_vma, bfd_elf_get_arch_size): Move renamed functions from here. * bfd.c (bfd_get_sign_extend_vma, bfd_get_arch_size): To here. * bfd-in.h (bfd_get_sign_extend_vma, bfd_get_arch_size): Update. * bfd-in2.h: Regenerate. Index: bfd/bfd-in.h =================================================================== RCS file: /cvs/src/src/bfd/bfd-in.h,v retrieving revision 1.14 diff -p -r1.14 bfd-in.h *** bfd-in.h 2000/07/11 07:28:25 1.14 --- bfd-in.h 2000/07/18 03:19:27 *************** extern long bfd_get_elf_phdr_upper_bound *** 644,653 **** extern int bfd_get_elf_phdrs PARAMS ((bfd *abfd, void *phdrs)); /* Return the arch_size field of an elf bfd, or -1 if not elf. */ ! extern int bfd_elf_get_arch_size PARAMS ((bfd *)); /* Return true if address "naturally" sign extends, or -1 if not elf. */ ! extern int bfd_elf_get_sign_extend_vma PARAMS ((bfd *)); /* SunOS shared library support routines for the linker. */ --- 644,653 ---- extern int bfd_get_elf_phdrs PARAMS ((bfd *abfd, void *phdrs)); /* Return the arch_size field of an elf bfd, or -1 if not elf. */ ! extern int bfd_get_arch_size PARAMS ((bfd *)); /* Return true if address "naturally" sign extends, or -1 if not elf. */ ! extern int bfd_get_sign_extend_vma PARAMS ((bfd *)); /* SunOS shared library support routines for the linker. */ Index: bfd/bfd.c =================================================================== RCS file: /cvs/src/src/bfd/bfd.c,v retrieving revision 1.5 diff -p -r1.5 bfd.c *** bfd.c 1999/12/10 18:51:34 1.5 --- bfd.c 2000/07/18 03:19:36 *************** _bfd_abort (file, line, fn) *** 706,711 **** --- 706,772 ---- /* FUNCTION + bfd_get_arch_size + + SYNOPSIS + int bfd_get_arch_size (bfd *abfd); + + DESCRIPTION + Returns the architecture address size, in bits, as determined + by the object file's format. For ELF, this information is + included in the header. + + RETURNS + Returns the arch size in bits if known, <<-1>> otherwise. */ + + int + bfd_get_arch_size (abfd) + bfd *abfd; + { + if (abfd->xvec->flavour == bfd_target_elf_flavour) + { + return (get_elf_backend_data (abfd))->s->arch_size; + } + bfd_set_error (bfd_error_wrong_format); + return -1; + } + + /* + FUNCTION + bfd_get_sign_extend_vma + + SYNOPSIS + int bfd_get_sign_extend_vma (bfd *abfd); + + DESCRIPTION + Indicates if the target architecture "naturally" sign extends + an address. Some architectures implicitly sign extend address + values when they are converted to types larger than the size + of an address. For instance, bfd_get_start_address() will + return an address sign extended to fill a bfd_vma when this is + the case. + + RETURNS + Returns <<1>> if the target architecture is known to sign + extend addresses, <<0>> if the target architecture is known to + not sign extend addresses, and <<-1>> otherwise. + + */ + + int + bfd_get_sign_extend_vma (abfd) + bfd *abfd; + { + if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) + { + return (get_elf_backend_data (abfd)->sign_extend_vma); + } + bfd_set_error (bfd_error_wrong_format); + return -1; + } + + /* + FUNCTION bfd_set_start_address SYNOPSIS Index: bfd/elf.c =================================================================== RCS file: /cvs/src/src/bfd/elf.c,v retrieving revision 1.38 diff -p -r1.38 elf.c *** elf.c 2000/07/11 07:28:25 1.38 --- elf.c 2000/07/18 03:19:45 *************** elf_fake_sections (abfd, asect, failedpt *** 1761,1796 **** *failedptr = true; } - /* Get elf arch size (32 / 64). - Returns -1 if not elf. */ - - int - bfd_elf_get_arch_size (abfd) - bfd *abfd; - { - if (abfd->xvec->flavour != bfd_target_elf_flavour) - { - bfd_set_error (bfd_error_wrong_format); - return -1; - } - - return (get_elf_backend_data (abfd))->s->arch_size; - } - - /* True if addresses "naturally" sign extend. Return 0/1 if known. - -1 if unknown. */ - int - bfd_elf_get_sign_extend_vma (abfd) - bfd *abfd; - { - if (bfd_get_flavour (abfd) != bfd_target_elf_flavour) - { - bfd_set_error (bfd_error_wrong_format); - return -1; - } - return (get_elf_backend_data (abfd)->sign_extend_vma); - } - /* Assign all ELF section numbers. The dummy first section is handled here too. The link/info pointers for the standard section types are filled in here too, while we're at it. */ --- 1761,1766 ----
- Previous message (by thread): [rfa] move bfd_elf_get_arch_size() et.al. to bfd.c:bfd_get...
- Next message (by thread): [rfa] move bfd_elf_get_arch_size() et.al. to bfd.c:bfd_get...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list