[patch] PR 12983: Fix nm to decompress debug sections when printing line numbers

Cary Coutant ccoutant@google.com
Tue Jul 12 09:43:00 GMT 2011
The nm tool doesn't currently request BFD to decompress input
sections, so when it tries to print line numbers we get an internal
error. This patch fixes that.

Is this OK for trunk? (I'd have called it obvious, but I wasn't sure
about the placement of the code to set the flag. The flag seems to
propagate to archive members, so it didn't seem necessary to set the
flag explicitly for each archive member.)

-cary


2011-07-11  Cary Coutant  <ccoutant@google.com>

	PR 12983
	* binutils/nm.c (display_file): Decompress debug sections when
	printing line numbers.


diff --git a/binutils/nm.c b/binutils/nm.c
index 2fc13b4..04067b1 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -1202,6 +1202,10 @@ display_file (char *filename)
       return FALSE;
     }

+  /* If printing line numbers, decompress the debug sections.  */
+  if (line_numbers)
+    file->flags |= BFD_DECOMPRESS;
+
   if (bfd_check_format (file, bfd_archive))
     {
       display_archive (file);



More information about the Binutils mailing list