This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
[rfa] bfd_elf_sign_extend_vma()
- To: BINUTILS Patches <binutils at sourceware dot cygnus dot com>
- Subject: [rfa] bfd_elf_sign_extend_vma()
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Fri, 23 Jun 2000 16:57:12 +1000
- Organization: Cygnus Solutions
Ok?
The attatched exports the internal ELF target value
``sign_extend_vma''. GDB, when it is reading in dwarf2 debug tables
needs this information to determine exactly how it should treat any
dwarf2 debug addresses.
The name and return value conventions are consistent with
bfd_elf_get_arch_size().
Andrew
Mon Jun 19 20:53:14 2000 Andrew Cagney <cagney@b1.cygnus.com>
* elf.c (bfd_elf_get_sign_extend_vma): Return tendency of VMA
addresses to be "naturally" sign extended. Return -1 if unknown.
* bfd-in2.h (bfd_elf_get_sign_extend_vma): : Add declaration.
Index: bfd-in2.h
===================================================================
RCS file: /cvs/cvsfiles/devo/bfd/bfd-in2.h,v
retrieving revision 1.383
diff -p -r1.383 bfd-in2.h
*** bfd-in2.h 2000/05/31 15:50:12 1.383
--- bfd-in2.h 2000/06/23 06:50:51
*************** extern int bfd_get_elf_phdrs PARAMS ((bf
*** 647,652 ****
--- 647,655 ----
/* 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. */
extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
Index: elf.c
===================================================================
RCS file: /cvs/cvsfiles/devo/bfd/elf.c,v
retrieving revision 1.257
diff -p -r1.257 elf.c
*** elf.c 2000/05/31 15:50:13 1.257
--- elf.c 2000/06/23 06:51:03
*************** bfd_elf_get_arch_size (abfd)
*** 1771,1776 ****
--- 1771,1790 ----
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. */