aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Gingold <tristan.gingold@adacore.com>2014-04-03 11:59:05 +0200
committerTristan Gingold <tristan.gingold@adacore.com>2014-04-04 14:17:06 +0200
commit4ef27e045fbd5b9ec41685ea3843f65fc15827af (patch)
treefdc6c78052b35754b54879679b51c1deb8e0abc2
parentffe54b3798db9112505e7f6b9d5e0d0b13823a29 (diff)
downloadfsf-binutils-gdb-4ef27e045fbd5b9ec41685ea3843f65fc15827af.zip
fsf-binutils-gdb-4ef27e045fbd5b9ec41685ea3843f65fc15827af.tar.gz
fsf-binutils-gdb-4ef27e045fbd5b9ec41685ea3843f65fc15827af.tar.bz2
bfd_get_arch_size: return size from arch info on non-ELF targets.
bfd/ * bfd.c (bfd_get_arch_size): Default is taken from arch.
-rw-r--r--bfd/ChangeLog4
-rw-r--r--bfd/bfd.c10
2 files changed, 10 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index c1c6b3e..e134050 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,7 @@
+2014-04-04 Tristan Gingold <gingold@adacore.com>
+
+ * bfd.c (bfd_get_arch_size): Default is taken from arch.
+
2014-04-03 Jon Turney <jon.turney@dronecode.org.uk>
* peXXigen.c (pe_print_edata): Verify edt.name lies inside
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 6b00592..41de1bb 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -1073,9 +1073,11 @@ 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 the normalized architecture address size, in bits, as
+ determined by the object file's format. By normalized, we mean
+ either 32 or 64. For ELF, this information is included in the
+ header. Use bfd_arch_bits_per_address for number of bits in
+ the architecture address.
RETURNS
Returns the arch size in bits if known, <<-1>> otherwise.
@@ -1087,7 +1089,7 @@ bfd_get_arch_size (bfd *abfd)
if (abfd->xvec->flavour == bfd_target_elf_flavour)
return get_elf_backend_data (abfd)->s->arch_size;
- return -1;
+ return bfd_arch_bits_per_address (abfd) > 32 ? 64 : 32;
}
/*