]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
size: Also obey radix printing for bsd format.
authorMark Wielaard <mark@klomp.org>
Thu, 14 May 2020 21:52:54 +0000 (23:52 +0200)
committerMark Wielaard <mark@klomp.org>
Thu, 14 May 2020 21:52:54 +0000 (23:52 +0200)
eu-size already prints according to the given radix for sysv format,
but not for the bsd format. Fix that.

Reported-by: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
src/ChangeLog
src/size.c

index 8c72e7d1a3a82b61a468041324ab857cac1d62e7..83fe19eb0d403a1b22bd00cb8d3a94e78e01c13b 100644 (file)
@@ -1,3 +1,7 @@
+2020-05-14  Mark Wielaard  <mark@klomp.org>
+
+       * size.c (show_bsd): Set printf format based on radix.
+
 2020-05-09  Mark Wielaard  <mark@klomp.org>
 
        * elflint.c (process_elf_file): Error out if ebl_openbackend fails.
index a25d4471f1c36459f1cecfeccd655892be60b711..e49b64b86a12bea3247783546cc10d29b9d3a262 100644 (file)
@@ -545,8 +545,11 @@ show_bsd (Elf *elf, const char *prefix, const char *fname,
        datasize += shdr->sh_size;
     }
 
-  printf ("%*" PRId64 " %*" PRId64 " %*" PRId64 " %*" PRId64 " %*"
-         PRIx64 " %s",
+  printf (radix == radix_decimal
+          ? "%*" PRId64 " %*" PRId64 " %*" PRId64 " %*" PRId64 " %*" PRIx64 " %s"
+         : radix == radix_hex
+         ? "%#*" PRIx64 " %#*" PRIx64 " %#*" PRIx64 " %*" PRId64 " %*" PRIx64 " %s"
+         : "%#*" PRIo64 " %#*" PRIo64 " %#*" PRIo64 " %*" PRId64 " %*" PRIx64 " %s",
          ddigits - 2, textsize,
          ddigits - 2, datasize,
          ddigits - 2, bsssize,