From 5ee0bc23a68fe2a6a7717b31fda1db878b2c9764 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 3 May 2021 23:27:16 -0400 Subject: 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. --- sim/rl78/ChangeLog | 4 ++++ sim/rl78/load.c | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) (limited to 'sim/rl78') diff --git a/sim/rl78/ChangeLog b/sim/rl78/ChangeLog index 9d70041..1be5181 100644 --- a/sim/rl78/ChangeLog +++ b/sim/rl78/ChangeLog @@ -1,3 +1,7 @@ +2021-05-04 Mike Frysinger + + * load.c (rl78_load): Use BFD_VMA_FMT and drop casts. + 2021-05-01 Mike Frysinger * config.in, configure: Regenerate. diff --git a/sim/rl78/load.c b/sim/rl78/load.c index f89b5e6..c137ba6 100644 --- a/sim/rl78/load.c +++ b/sim/rl78/load.c @@ -128,12 +128,15 @@ rl78_load (bfd *prog, host_callback *callbacks, const char * const simname) base = p->p_paddr; if (verbose > 1) - fprintf (stderr, "[load segment: lma=%08x vma=%08x size=%08x]\n", - (int) base, (int) p->p_vaddr, (int) size); + fprintf (stderr, + "[load segment: lma=%08" BFD_VMA_FMT "x vma=%08x " + "size=%08" BFD_VMA_FMT "x]\n", + base, (int) p->p_vaddr, size); if (callbacks) xprintf (callbacks, - "Loading section %s, size %#lx lma %08lx vma %08lx\n", - find_section_name_by_offset (prog, p->p_offset), + "Loading section %s, size %#" BFD_VMA_FMT "x " + "lma %08" BFD_VMA_FMT "x vma %08lx\n", + find_section_name_by_offset (prog, p->p_offset), size, base, p->p_vaddr); buf = xmalloc (size); @@ -147,13 +150,16 @@ rl78_load (bfd *prog, host_callback *callbacks, const char * const simname) if (bfd_bread (buf, size, prog) != size) { - fprintf (stderr, "%s: Failed to read %lx bytes\n", simname, size); + fprintf (stderr, "%s: Failed to read %" BFD_VMA_FMT "x bytes\n", + simname, size); continue; } if (base > 0xeffff || base + size > 0xeffff) { - fprintf (stderr, "%s, Can't load image to RAM/SFR space: 0x%lx - 0x%lx\n", + fprintf (stderr, + "%s, Can't load image to RAM/SFR space: 0x%" BFD_VMA_FMT "x " + "- 0x%" BFD_VMA_FMT "x\n", simname, base, base+size); continue; } -- cgit v1.1