This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Committed: fix binutils/dwarf.c after "Revise sleb128 and uleb128 reader"


> From: Alan Modra <amodra@gmail.com>
> Date: Mon, 23 Dec 2019 08:31:14 +0100

> This patch catches and reports errors when reading leb128 values,
> addressing a FIXME in read_leb128.

> 	* dwarf.c: Use above macros throughout file.  Formatting.
...
> 	(display_debug_lines_decoded): Likewise.  Properly check for end
> 	of DW_LNS_extended_op.

gcc -O2 -m32 -DHAVE_CONFIG_H -I. -I/tmp/hpautotest-binutils/bsrc/src/binutils  -I. -I/tmp/hpautotest-binutils/bsrc/src/binutils -I../bfd -I/tmp/hpautotest-binutils/bsrc/src/binutils/../bfd -I/tmp/hpautotest-binutils/bsrc/src/binutils/../include -DLOCALEDIR="\"/usr/local/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror -I/tmp/hpautotest-binutils/bsrc/src/binutils/../zlib -g -O2 -MT dwarf.o -MD -MP -MF $depbase.Tpo -c -o dwarf.o /tmp/hpautotest-binutils/bsrc/src/binutils/dwarf.c &&\
mv -f $depbase.Tpo $depbase.Po
In file included from /tmp/hpautotest-binutils/bsrc/src/binutils/sysdep.h:151:0,
                 from /tmp/hpautotest-binutils/bsrc/src/binutils/dwarf.c:21:
/tmp/hpautotest-binutils/bsrc/src/binutils/dwarf.c: In function 'display_debug_lines_decoded':
/tmp/hpautotest-binutils/bsrc/src/binutils/dwarf.c:4719:19: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'int' [-Werror=format=]
         printf (_("UNKNOWN (%u): length %ld\n"),
                   ^
/tmp/hpautotest-binutils/bsrc/src/binutils/dwarf.c:4719:17: note: in expansion of macro '_'
         printf (_("UNKNOWN (%u): length %ld\n"),
                 ^
cc1: all warnings being treated as errors
Makefile:1085: recipe for target 'dwarf.o' failed
make[4]: *** [dwarf.o] Error 1
make[4]: Leaving directory '/tmp/hpautotest-binutils/cris-axis-elf/binutils'
make[3]: *** [all-recursive] Error 1

(Key issue: "32-bit build".  See options and file paths for full build context.)

Fixes the build (and tests fine for cris-elf), committed as obvious:

binutils:    
    	* dwarf.c (display_debug_lines_decoded): Cast printf parameter to
    	format type to correct last change.

diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 30abee5..9797312 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -4717,7 +4717,7 @@ display_debug_lines_decoded (struct dwarf_section *  section,
 
 		    default:
 		      printf (_("UNKNOWN (%u): length %ld\n"),
-			      ext_op_code, op_code_data - data);
+			      ext_op_code, (long int) (op_code_data - data));
 		      break;
 		    }
 		  data = op_code_end;

Merry Christmas.
brgds, H-P


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]