Re: Some more GCC10 -fanalyzer inspired patches

2020-05-14 Thread Mark Wielaard
On Sun, 2020-05-10 at 21:53 +0200, Mark Wielaard wrote:
> I did another build with the final GCC10 and -fanalyzer. The
> -Wanalyzer-use-of-uninitialized-value option was removed, which caused
> a lot of false positives. Without those it was easier to identify some
> real issues. I also tried -fanalyze together with -flto. This takes a
> lot of memory (linking libdw.so uses > 12GB) but does allow -fanalyzer
> to detect some cross-function issues.
> 
> [PATCH 1/7] libdwfl: Cleanup user_core resources on failure in
> [PATCH 2/7] tests: Make sure to not call memcmp with NULL arguments.
> [PATCH 3/7] libelf: Check __gelf_getehdr_rdlock call doesn't fail in
> [PATCH 4/7] libelf: Check for NULL shdr in elf_strptr.
> [PATCH 5/7] src: Check ebl_openbackend result before using ebl
> [PATCH 6/7] libdwfl: Return failure from dwfl_standard_find_debuginfo
> [PATCH 7/7] libcpu: Free unused new bitfield on error in i386_parse.y
> 
> I think they all are for real issues, although probably fairly hard
> to trigger. All are somewhat trivial and I intent to check them in soon.

I pushed all 7 patches to elfutils git master.


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

2020-05-14 Thread Mark Wielaard
eu-size already prints according to the given radix for sysv format,
but not for the bsd format. Fix that.

Reported-by: Ulrich Drepper 
Signed-off-by: Mark Wielaard 
---
 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  
+
+   * size.c (show_bsd): Set printf format based on radix.
+
 2020-05-09  Mark Wielaard  
 
* 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