From 73febefd250e76f9183638036d70381e43130fea Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Tue, 11 Jul 2000 07:28:25 +0000 Subject: [PATCH] Add function bfd_elf_get_sign_extend_vma. --- bfd/ChangeLog | 7 +++++++ bfd/bfd-in.h | 3 +++ bfd/bfd-in2.h | 3 +++ bfd/elf.c | 14 ++++++++++++++ 4 files changed, 27 insertions(+) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index ba58bfa158..bde689fe58 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +Tue Jul 11 17:21:52 2000 Andrew Cagney + + * elf.c (bfd_elf_get_sign_extend_vma): Return tendency of VMA + addresses to be "naturally" sign extended. Return -1 if unknown. + * bfd-in.h (bfd_elf_get_sign_extend_vma): : Add declaration. + * bfd-in2.h: Regenerate. + Tue Jul 11 16:25:52 2000 Andrew Cagney * ecoffswap.h (ecoff_get_off, ecoff_put_off): Add ECOFF_SIGNED_32 diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index f0a1d84ebd..80be3036fe 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -646,6 +646,9 @@ 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. */ extern struct bfd_link_needed_list *bfd_sunos_get_needed_list diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index b151e259a9..adf2dd8b80 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -646,6 +646,9 @@ 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. */ extern struct bfd_link_needed_list *bfd_sunos_get_needed_list diff --git a/bfd/elf.c b/bfd/elf.c index f88ebbd6ee..d334cb9f52 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -1777,6 +1777,20 @@ bfd_elf_get_arch_size (abfd) 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. */ -- 2.11.0