From 9eb20dd876711c0e7d27a52d38676dfb721b0c43 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Wed, 26 Nov 2003 11:49:10 +0000 Subject: [PATCH] Add a comment describing the difference between readelf and objdump. --- binutils/ChangeLog | 7 +++++++ binutils/doc/binutils.texi | 5 +++++ binutils/readelf.c | 20 +++++++++++++++++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 3b73d06..e7d5309 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,10 @@ +2003-11-26 Daniel Jacobowitz + Nick Clifton + + * readelf.c: Add a comment describing the difference between + readelf and objdump. + * doc/binutils.texi (readelf): Likewise. + 2003-11-25 Danny Smith * doc/binutils.texi (dlltool): Document dlltool --temp-prefix diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi index 128645c..ffa680f 100644 --- a/binutils/doc/binutils.texi +++ b/binutils/doc/binutils.texi @@ -3129,6 +3129,11 @@ files. The options control what particular information to display. @var{elffile}@dots{} are the object files to be examined. 32-bit and 64-bit ELF files are supported, as are archives containing ELF files. +This program performs a similar function to @command{objdump} but it +goes into more detail and it exists independently of the @sc{bfd} +library, so if there is a bug in @sc{bfd} then readelf will not be +affected. + @c man end @c man begin OPTIONS readelf diff --git a/binutils/readelf.c b/binutils/readelf.c index 9b8b12e..a11d53b 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -21,7 +21,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - +/* The difference between readelf and objdump: + + Both programs are capabale of displaying the contents of ELF format files, + so why does the binutils project have two file dumpers ? + + The reason is that objdump sees an ELF file through a BFD filter of the + world; if BFD has a bug where, say, it disagrees about a machine constant + in e_flags, then the odds are good that it will remain internally + consistent. The linker sees it the BFD way, objdump sees it the BFD way, + GAS sees it the BFD way. There was need for a tool to go find out what + the file actually says. + + This is why the readelf program does not link against the BFD library - it + exists as an independent program to help verify the correct working of BFD. + + There is also the case that readelf can provide more information about an + ELF file than is provided by objdump. In particular it can display DWARF + debugging information which (at the moment) objdump cannot. */ + #include #include #include -- 2.7.4