]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim: common: fix printf formats
authorMike Frysinger <vapier@gentoo.org>
Sat, 9 Jan 2021 19:06:15 +0000 (14:06 -0500)
committerMike Frysinger <vapier@gentoo.org>
Mon, 11 Jan 2021 13:27:40 +0000 (08:27 -0500)
For 32-bit targets, %x happens to work for unsigned_word.  But for
64-bit targets, it's too small, and gcc throws an error.  Use the
right printf format define for them.

sim/common/ChangeLog
sim/common/sim-core.c

index 6ffee1610d730d3fd8a206e3b6f20d8ed343a5c6..8039a78e3277d3de604b8c90c29368226574298d 100644 (file)
@@ -1,3 +1,7 @@
+2021-01-11  Mike Frysinger  <vapier@gentoo.org>
+
+       * sim-core.c (sim_memory_map): Change %#x to PRIxTW.
+
 2021-01-11  Mike Frysinger  <vapier@gentoo.org>
 
        * acinclude.m4 (SIM_AC_COMMON): Delete checks for stdlib.h, string.h,
index ade345ef16fb25b98506c9aa8d49cf1c1408b252..9b1e168321043398f84f142aa443aeb13df42e66 100644 (file)
@@ -480,7 +480,8 @@ sim_memory_map (SIM_DESC sd)
          if (mapping->level != 0)
            continue;
 
-         entry = xasprintf ("<memory type='ram' start='%#x' length='%#x'/>\n",
+         entry = xasprintf ("<memory type='ram' start='%#" PRIxTW "' "
+                            "length='%#" PRIxTW "'/>\n",
                             mapping->base, mapping->nr_bytes);
          /* The sim memory map is organized by access, not by addresses.
             So a RWX memory map will have three independent mappings.