This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: readelf: Print sh_flags in hex
On Tue, Aug 09, 2005 at 10:27:28AM +0100, Nick Clifton wrote:
> 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"
I can do that.
>
> 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
Sure.
> this new switch is that it is not prefixed by "0x" so that the reader
> knows that it is a hexadecimal value.
None of the hex values are displayed with 0x prefix. But I don't mind
to add one to section flag.
>
> 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)
If a section flag has more than a few bits, like WAXPoILG, a line may
be too long. I add this flag because I want to see exactly what HP
linker puts there. 'o' and 'p' aren't tell me anything. May be
[Nr] Name Type Addr Off Size ES Lk Inf Al
Flags
[ 0] .text PROGBITS 00001010 001010 000011 00 0 0 4
[0x10000006]: ALLOC, EXEC, PROC (0x1000000)
will work since most, if not all, of OS/PROC SHF_XXX are defined as
0xXXXXXXXX.
>
>
> The other problem with the patch is that you did not include
> documentation for the
> -f/--section-flags switch in the binutils.texi file.
I can add it.
H.J.