aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfcode.h
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>1999-11-18 01:06:45 +0000
committerRichard Henderson <rth@redhat.com>1999-11-18 01:06:45 +0000
commit86dc0f79f59480ef98f870c71d2e38ea23e56a04 (patch)
treee77d39aec1b71c080b4520e09dd6103f9e562333 /bfd/elfcode.h
parent22b3e891f0fe72093d144f7442aa9c777e5a6bf4 (diff)
downloadgdb-86dc0f79f59480ef98f870c71d2e38ea23e56a04.zip
gdb-86dc0f79f59480ef98f870c71d2e38ea23e56a04.tar.gz
gdb-86dc0f79f59480ef98f870c71d2e38ea23e56a04.tar.bz2
* elf-bfd.h (struct elf_backend_data): Reorder collect and
type_change_ok; add sign_extend_vma. * elf32-mips.c (elf_backend_sign_extend_vma): Define. * elfcode.h (elf_swap_symbol_in): Mind be->sign_extend_vma. (elf_swap_shdr_in, elf_swap_phdr_in): Likewise. * elfxx-target.h (elf_backend_sign_extend_vma): Default. (elfNN_bed): Follow struture changes.
Diffstat (limited to 'bfd/elfcode.h')
-rw-r--r--bfd/elfcode.h28
1 files changed, 24 insertions, 4 deletions
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index 1f75fb0..c5edf9b 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -207,8 +207,13 @@ elf_swap_symbol_in (abfd, src, dst)
const Elf_External_Sym *src;
Elf_Internal_Sym *dst;
{
+ int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
+
dst->st_name = bfd_h_get_32 (abfd, (bfd_byte *) src->st_name);
- dst->st_value = get_word (abfd, (bfd_byte *) src->st_value);
+ if (signed_vma)
+ dst->st_value = get_signed_word (abfd, (bfd_byte *) src->st_value);
+ else
+ dst->st_value = get_word (abfd, (bfd_byte *) src->st_value);
dst->st_size = get_word (abfd, (bfd_byte *) src->st_size);
dst->st_info = bfd_h_get_8 (abfd, (bfd_byte *) src->st_info);
dst->st_other = bfd_h_get_8 (abfd, (bfd_byte *) src->st_other);
@@ -295,10 +300,15 @@ elf_swap_shdr_in (abfd, src, dst)
const Elf_External_Shdr *src;
Elf_Internal_Shdr *dst;
{
+ int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
+
dst->sh_name = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_name);
dst->sh_type = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_type);
dst->sh_flags = get_word (abfd, (bfd_byte *) src->sh_flags);
- dst->sh_addr = get_word (abfd, (bfd_byte *) src->sh_addr);
+ if (signed_vma)
+ dst->sh_addr = get_signed_word (abfd, (bfd_byte *) src->sh_addr);
+ else
+ dst->sh_addr = get_word (abfd, (bfd_byte *) src->sh_addr);
dst->sh_offset = get_word (abfd, (bfd_byte *) src->sh_offset);
dst->sh_size = get_word (abfd, (bfd_byte *) src->sh_size);
dst->sh_link = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_link);
@@ -341,11 +351,21 @@ elf_swap_phdr_in (abfd, src, dst)
const Elf_External_Phdr *src;
Elf_Internal_Phdr *dst;
{
+ int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
+
dst->p_type = bfd_h_get_32 (abfd, (bfd_byte *) src->p_type);
dst->p_flags = bfd_h_get_32 (abfd, (bfd_byte *) src->p_flags);
dst->p_offset = get_word (abfd, (bfd_byte *) src->p_offset);
- dst->p_vaddr = get_word (abfd, (bfd_byte *) src->p_vaddr);
- dst->p_paddr = get_word (abfd, (bfd_byte *) src->p_paddr);
+ if (signed_vma)
+ {
+ dst->p_vaddr = get_signed_word (abfd, (bfd_byte *) src->p_vaddr);
+ dst->p_paddr = get_signed_word (abfd, (bfd_byte *) src->p_paddr);
+ }
+ else
+ {
+ dst->p_vaddr = get_word (abfd, (bfd_byte *) src->p_vaddr);
+ dst->p_paddr = get_word (abfd, (bfd_byte *) src->p_paddr);
+ }
dst->p_filesz = get_word (abfd, (bfd_byte *) src->p_filesz);
dst->p_memsz = get_word (abfd, (bfd_byte *) src->p_memsz);
dst->p_align = get_word (abfd, (bfd_byte *) src->p_align);