[COMMITTED] size: Also obey radix printing for bsd format.

Mark Wielaard mark@klomp.org
Thu May 14 22:08:45 GMT 2020


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 | 4 ++++
 src/size.c    | 7 +++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 8c72e7d1..83fe19eb 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -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.
diff --git a/src/size.c b/src/size.c
index a25d4471..e49b64b8 100644
--- a/src/size.c
+++ b/src/size.c
@@ -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,
-- 
2.20.1



More information about the Elfutils-devel mailing list