[ANNOUNCEMENT] Updated: binutils-20050520-1

Lev Bishop lev.bishop@gmail.com
Wed May 25 13:09:00 GMT 2005


I don't have much clue what I'm doing with binutils, but I've managed
to cause a SEGV in objdump. Here's how:
$ cat > a.c
int main (void)
{
        int i=1;
        i++;
        return i;
}
$ gcc a.c
$ objcopy -O elf32-i386 a.exe
$ objcopy -O pei-i386 a.exe
$ objdump -x a.exe
a.exe:     file format pei-i386
a.exe
architecture: i386, flags 0x00000132:
EXEC_P, HAS_SYMS, HAS_LOCALS, D_PAGED
start address 0x00401000

Characteristics 0x307
        relocations stripped
        executable
        line numbers stripped
        32 bit words
        debugging information removed

Time/Date               Wed May 25 06:43:15 2005

ImageBase               00000000
SectionAlignment        00000000
FileAlignment           00000000
MajorOSystemVersion     0
MinorOSystemVersion     0
MajorImageVersion       0
MinorImageVersion       0
MajorSubsystemVersion   0
MinorSubsystemVersion   0
Win32Version            00000000
SizeOfImage             00000000
SizeOfHeaders           00000400
CheckSum                00010ed7
Subsystem               00000000        (unspecified)
DllCharacteristics      00000000
SizeOfStackReserve      00000000
SizeOfStackCommit       00000000
SizeOfHeapReserve       00000000
SizeOfHeapCommit        00000000
LoaderFlags             00000000
NumberOfRvaAndSizes     00000010


The Data Directory
Entry 0 00000000 00000000 Export Directory [.edata (or where ever we found it)]
Entry 1 00405000 000001f0 Import Directory [parts of .idata]
Entry 2 00000000 00000000 Resource Directory [.rsrc]
Entry 3 00000000 00000000 Exception Directory [.pdata]
Entry 4 00000000 00000000 Security Directory
Entry 5 00000000 00000000 Base Relocation Directory [.reloc]
Entry 6 00000000 00000000 Debug Directory
Entry 7 00000000 00000000 Description Directory
Entry 8 00000000 00000000 Special Directory
Entry 9 00000000 00000000 Thread Storage Directory [.tls]
Entry a 00000000 00000000 Load Configuration Directory
Entry b 00000000 00000000 Bound Import Directory
Entry c 00000000 00000000 Import Address Table Directory
Entry d 00000000 00000000 Delay Import Directory
Entry e 00000000 00000000 Reserved
Entry f 00000000 00000000 Reserved

There is an import table in .idata at 0x405000

The Import Tables (interpreted .idata section contents)
 vma:            Hint    Time      Forward  DLL       First
                 Table   Stamp     Chain    Name      Thunk
 00405000       00005040 00000000 00000000 000051c4 00005088
Segmentation fault (core dumped)

This happens with the new binutils and also the previous version. 

(What I was actually hoping to do above was to remove/normalize the
time/date header in pei-i386, so that my executables are repeatable
functions of their sources, so I can checksum/fingerprint them in my
build system. Clearly my above attempts failed, so does anybody know
of a way to acheive this?)

Lev

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list