[PATCH] Fix for readelf hex-dump SHT_NOBITS bug
Marshall T. Vandegrift
llasram@wuli.nu
Fri Oct 24 03:00:00 GMT 2003
Hi,
This looks like an obvious fix to me. Currently, `readelf --hex-dump'
on a SHT_NOBITS section will attempt to dump the section's sh_size
bytes from the file (failing cleanly if the file is too small). This
patch makes it treat SHT_NOBITS sections as zero bytes in size.
2003-10-23 Marshall T. Vandegrift <llasram@wuli.nu>
* readelf.c (dump_section): Correctly treat SHT_NOBITS sections as
zero bytes in size.
diff -aurpE binutils/binutils/readelf.c binutils-modified/binutils/readelf.c
--- binutils/binutils/readelf.c 2003-10-23 22:34:41.000000000 -0400
+++ binutils-modified/binutils/readelf.c 2003-10-23 22:30:25.000000000 -0400
@@ -6055,7 +6055,7 @@ dump_section (Elf_Internal_Shdr *section
bytes = section->sh_size;
- if (bytes == 0)
+ if (bytes == 0 || section->sh_type == SHT_NOBITS)
{
printf (_("\nSection '%s' has no data to dump.\n"),
SECTION_NAME (section));
--
Marshall T. Vandegrift <llasram@wuli.nu>
A lie which has the air of truth is preferable to
an accurate statement which seems to be false.
-- Kai Kā'ūs ibn Iskandar, the /Qābūs-nāma/
More information about the Binutils
mailing list