This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: readelf: Print sh_flags in hex
- From: Nick Clifton <nickc at redhat dot com>
- To: "H. J. Lu" <hjl at lucon dot org>
- Cc: binutils at sources dot redhat dot com
- Date: Tue, 09 Aug 2005 10:27:28 +0100
- Subject: Re: PATCH: readelf: Print sh_flags in hex
- References: <20050808190154.GA5874@lucon.org>
Hi H. J.
When sh_flags has processor/OS specific bits, there is no way to see
what they really are. This patch adds a -f switch to dump sh_flags in
hex.
There are a couple of problems with this patch:
+ if (do_full_section_flags)
+ {
+ sprintf (buff, "%08x", (int) sh_flags);
+ return buff;
+ }
This means that the decoded values of the flags will not be shown. If
this is the intended purpose then the description displayed by --help
ought to explicitly say that. ie change:
"Display the full section flags"
to:
"Display the section flags as a hexadecimal value"
Presumably the --section-flags switch implies the --section switch, so
the code in parse_args() to handle case 'f' ought to include a
"do_sections++". The other, minor problem with the value displayed by
this new switch is that it is not prefixed by "0x" so that the reader
knows that it is a hexadecimal value.
In my opinion however I think that it would be more useful if the
--section-flags switch not only displayed the hex value of the flags
field, but it also provided a more verbose decoding of these flags. ie
"Write" instead of "W", "TLS instead of "T", and so on. It could also
specifically show which bits of the OS and PROC specific flags are set.
(This could be deduced from the full hex display, but it makes it
easier for the user). This would however probably require displaying
the flags on a line of their own. eg:
[Nr] Name Type Addr Off Size ES Lk Inf Al
[ 0] .text PROGBITS 00001010 001010 000011 00 0 0 4
Flags [0x10000006]: Allocate, Executable, PROC Specific (1 << 28)
The other problem with the patch is that you did not include
documentation for the
-f/--section-flags switch in the binutils.texi file.
Cheers
Nick