RFC: Objdump: Dumping PE specific headers
Nick Clifton
nickc@redhat.com
Thu May 25 16:21:46 GMT 2023
Hi Guys,
Whilst looking at PR 310145, I realised that we currently do not have
a way to display the contents of PE type files in their native
format. Since objdump does have a --private option which provides
this kind of functionality for other file format types, I thought that
it would be helpful if objdump could also handle PE files. Hence this
patch.
At the moment it only dumps the file header and section headers, but
this could be extended in the future. (Especially if someone else is
interested in doing the work...). The output looks something like
this:
$ objdump -P header,sections test-section-flags.exe --wide
test-section-flags.exe: file format pei-x86-64
PEI File Header:
Magic: 0x5a4d - IMAGE_DOS_SIGNATURE
Machine Num: 0x8664 - AMD64
Num sections: 6
Time and date: 0x646f522d - Thu May 25 13:18:53 2023
Symbols off: 0x00001000
Num symbols: 60
Opt hdr sz: 240
flags: 0x0226 - EXECUTABLE,LINE NUMS STRIPPED,LARGE ADDRESS AWARE,DEBUG STRIPPED
Section headers (at 152+240=0x00000188 to 0x00000278):
# Name paddr vaddr size scnptr relptr lnnoptr nrel nlnno Flags
1 .text 00000030 00001000 00000200 00000400 00000000 00000000 0 0 60000020 EXECUTE,READ,CODE
2 my_sect 00000004 00002000 00000200 00000600 00000000 00000000 0 0 c0000040 READ,WRITE,INITIALIZED DATA
3 .rdata 00000040 00003000 00000200 00000800 00000000 00000000 0 0 40000040 READ,INITIALIZED DATA
4 .pdata 0000000c 00004000 00000200 00000a00 00000000 00000000 0 0 40000040 READ,INITIALIZED DATA
5 .xdata 00000008 00005000 00000200 00000c00 00000000 00000000 0 0 40000040 READ,INITIALIZED DATA
6 .idata 00000014 00006000 00000200 00000e00 00000000 00000000 0 0 c0000040 READ,WRITE,INITIALIZED DATA
Thoughts, comments ?
Cheers
Nick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr30145.patch
Type: text/x-patch
Size: 15315 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20230525/b2117e7b/attachment-0001.bin>
More information about the Binutils
mailing list