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]

[Patch] Quit truncating dynamic tag values in readelf.


In readelf, the printing of of DT_MIPS_* dynamic tag values was being done with the printf 'l' format specifier. Since the values are 64 bits wide, this resulted in the truncation and printing of only the lower 32 bits on hosts with 32-bit long.

readelf has already defined print_vma() and BFD_VMA_FMT just for printing these values, so use these instead in dynamic_section_mips_val(). Since print_vma() does not print the trailing '\n' we need to emit this with a separate putchar('\n') call. The code becomes cleaner if we use this putchar() for all the cases, so we also remove the '\n' from the other strings in the function.

Tested on mips64-linux-gnu and x86_64-linux-gnu with no regressions.

OK to commit?

2011-12-06 David Daney <david.daney@cavium.com>

	* readelf.c (dynamic_section_mips_val): Factor out trailing '\n'
	from printed strings and move it to the end of the function.
	Use BFD_VMA_FMT for printf format specifier for dynamic tag value.
	Use print_vma() to print dynamic tag values.

Attachment: readelf.patch
Description: Text document


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