aboutsummaryrefslogtreecommitdiff
path: root/sim/common/sim-load.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-05-03 23:27:16 -0400
committerMike Frysinger <vapier@gentoo.org>2021-05-04 08:13:45 -0400
commit5ee0bc23a68fe2a6a7717b31fda1db878b2c9764 (patch)
tree89d9ac8cad39ef7afdf6dfa1d93a5f06b87a440f /sim/common/sim-load.c
parent225bda24db9671e2087fda892f94141625836a40 (diff)
downloadfsf-binutils-gdb-5ee0bc23a68fe2a6a7717b31fda1db878b2c9764.zip
fsf-binutils-gdb-5ee0bc23a68fe2a6a7717b31fda1db878b2c9764.tar.gz
fsf-binutils-gdb-5ee0bc23a68fe2a6a7717b31fda1db878b2c9764.tar.bz2
sim: clean up bfd_vma printing
A lot of this code predates the bfd_vma format define, so we have a random mix of casts to known types so we can printf the value. Use the BFD_VMA_FMT that now exists to simplify and reliability output across different build configs.
Diffstat (limited to 'sim/common/sim-load.c')
-rw-r--r--sim/common/sim-load.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/sim/common/sim-load.c b/sim/common/sim-load.c
index e0aab1e..04681c5 100644
--- a/sim/common/sim-load.c
+++ b/sim/common/sim-load.c
@@ -38,7 +38,6 @@ static void eprintf (host_callback *, const char *, ...);
static void xprintf (host_callback *, const char *, ...);
static void report_transfer_performance
(host_callback *, unsigned long, time_t, time_t);
-static void xprintf_bfd_vma (host_callback *, bfd_vma);
/* Load program PROG into the simulator using the function DO_LOAD.
If PROG_BFD is non-NULL, the file has already been opened.
@@ -122,12 +121,12 @@ sim_load_file (SIM_DESC sd, const char *myname, host_callback *callback,
lma = bfd_section_vma (s);
if (verbose_p)
{
- xprintf (callback, "Loading section %s, size 0x%lx %s ",
+ xprintf (callback,
+ "Loading section %s, size 0x%lx %s "
+ "%" BFD_VMA_FMT "x\n",
bfd_section_name (s),
(unsigned long) size,
- (lma_p ? "lma" : "vma"));
- xprintf_bfd_vma (callback, lma);
- xprintf (callback, "\n");
+ (lma_p ? "lma" : "vma"), lma);
}
data_count += size;
bfd_get_section_contents (result_bfd, s, buffer, 0, size);
@@ -149,9 +148,8 @@ sim_load_file (SIM_DESC sd, const char *myname, host_callback *callback,
if (verbose_p)
{
end_time = time (NULL);
- xprintf (callback, "Start address ");
- xprintf_bfd_vma (callback, bfd_get_start_address (result_bfd));
- xprintf (callback, "\n");
+ xprintf (callback, "Start address %" BFD_VMA_FMT "x\n",
+ bfd_get_start_address (result_bfd));
report_transfer_performance (callback, data_count, start_time, end_time);
}
@@ -198,13 +196,3 @@ report_transfer_performance (host_callback *callback, unsigned long data_count,
xprintf (callback, "%ld bits in <1 sec", (data_count * 8));
xprintf (callback, ".\n");
}
-
-/* Print a bfd_vma.
- This is intended to handle the vagaries of 32 vs 64 bits, etc. */
-
-static void
-xprintf_bfd_vma (host_callback *callback, bfd_vma vma)
-{
- /* FIXME: for now */
- xprintf (callback, "0x%lx", (unsigned long) vma);
-}