[binutils-gdb] Re: PR25244, --print-memory-usage, division by zero if MEMORY length is zero

Alan Modra amodra@sourceware.org
Thu Dec 5 11:21:00 GMT 2019


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2410edcd3176d81d0ab8d24afe69f0d59649f69e

commit 2410edcd3176d81d0ab8d24afe69f0d59649f69e
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Dec 5 21:29:21 2019 +1030

    Re: PR25244, --print-memory-usage, division by zero if MEMORY length is zero
    
    Do print the linefeed when length is zero.
    
    	PR 25244
    	* ldlang.c (lang_print_memory_usage): Correct last patch.

Diff:
---
 ld/ChangeLog | 5 +++++
 ld/ldlang.c  | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ld/ChangeLog b/ld/ChangeLog
index b3318cb..eb15dac 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,10 @@
 2019-12-05  Alan Modra  <amodra@gmail.com>
 
+	PR 25244
+	* ldlang.c (lang_print_memory_usage): Correct last patch.
+
+2019-12-05  Alan Modra  <amodra@gmail.com>
+
 	PR 25243
 	* emulparams/armelf.sh (OTHER_READONLY_SECTIONS): Move definition
 	of __exidx_start and __exidx_end into ARM.exidx.
diff --git a/ld/ldlang.c b/ld/ldlang.c
index bb3cd91..05ea0c8 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -9281,7 +9281,8 @@ lang_print_memory_usage (void)
       if (r->length != 0)
 	{
 	  double percent = used_length * 100.0 / r->length;
-	  printf ("    %6.2f%%\n", percent);
+	  printf ("    %6.2f%%", percent);
 	}
+      printf ("\n");
     }
 }



More information about the Binutils-cvs mailing list