aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2007-04-02 16:51:13 +0000
committerNick Clifton <nickc@redhat.com>2007-04-02 16:51:13 +0000
commit970ccc773455dbe0a2ab943f110162ed87c580d8 (patch)
tree17f2e27e2c91c40a8cfbca677bc04f4bb77cf774 /bfd
parentf856040accecf254a5130936e69218ed935711a6 (diff)
downloadgdb-970ccc773455dbe0a2ab943f110162ed87c580d8.zip
gdb-970ccc773455dbe0a2ab943f110162ed87c580d8.tar.gz
gdb-970ccc773455dbe0a2ab943f110162ed87c580d8.tar.bz2
PR binutils/4292
* bfd.c (bfd_fprintf_vma): Do not print addresses of 32-bit targets as 64-bit values, even if running on a 64-bit host. * coffgen.c (coff_print_symbol): Likewise. * nm.c (value_format): Replace with value_format_32bit and value_format_64bit. (set_radix): Update setting of value_format. (set_print_width): New function. Compute the address size of a given bfd and set the print_width global appropriately. (display_archive): Use set_print_width. (display_file): Likewise, (print_object_filename_sysv): Update use of print_width. (print_archive_member_sysv): Likewise. (print_symbol_filename_posix): Likewise. (print_sumbol_info_bfd, print_symbol_info_sysv): Likewise.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/bfd.c9
-rw-r--r--bfd/coffgen.c11
3 files changed, 26 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 948b4e3..96f8252 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2007-04-02 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/4292
+ * bfd.c (bfd_fprintf_vma): Do not print addresses of 32-bit
+ targets as 64-bit values, even if running on a 64-bit host.
+ * coffgen.c (coff_print_symbol): Likewise.
+
2007-03-29 Nick Clifton <nickc@redhat.com>
PR binutils/4110
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 79ae8a9..381e3d7 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -1388,6 +1388,15 @@ bfd_fprintf_vma (bfd *abfd, void *stream, bfd_vma value)
{
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
get_elf_backend_data (abfd)->elf_backend_fprintf_vma (abfd, stream, value);
+#ifdef BFD64
+ /* fprintf_vma() on a 64-bit enabled host will always print a 64-bit
+ value, but really we want to display the address in the target's
+ address size. Since we do not have a field in the bfd structure
+ to tell us this, we take a guess, based on the target's name. */
+ else if (strstr (bfd_get_target (abfd), "64") == NULL
+ && strcmp (bfd_get_target (abfd), "mmo") != 0)
+ fprintf ((FILE *) stream, "%08lx", (unsigned long) (value & 0xffffffff));
+#endif
else
fprintf_vma ((FILE *) stream, value);
}
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index bef7d7a..c87967d 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -1901,7 +1901,16 @@ coff_print_symbol (bfd *abfd,
combined->u.syment.n_type,
combined->u.syment.n_sclass,
combined->u.syment.n_numaux);
- fprintf_vma (file, val);
+#ifdef BFD64
+ /* fprintf_vma() on a 64-bit enabled host will always print a 64-bit
+ value, but really we want to display the address in the target's
+ address size. Since we do not have a field in the bfd structure
+ to tell us this, we take a guess, based on the target's name. */
+ if (strstr (bfd_get_target (abfd), "64") == NULL)
+ fprintf (file, "%08lx", (unsigned long) (val & 0xffffffff));
+ else
+#endif
+ fprintf_vma (file, val);
fprintf (file, " %s", symbol->name);
for (aux = 0; aux < combined->u.syment.n_numaux; aux++)