Bug 6026

Summary: objdump craches on simple *.exe / application doesn't work.
Product: binutils Reporter: Pawel Sikora <pluto>
Component: binutilsAssignee: Kai Tietz <ktietz>
Status: RESOLVED FIXED    
Severity: normal CC: bug-binutils
Priority: P2    
Version: 2.18   
Target Milestone: ---   
Host: x86_64-gnu-linux Target: x86_64-pc-mingw32
Build: Last reconfirmed:
Attachments: testcase
dep walker report.
Fix for problem

Description Pawel Sikora 2008-04-03 10:18:55 UTC
$ x86_64-pc-mingw32-objdump -p a.exe

(...)
        DLL Name: b.dll
        vma:  Hint/Ord Member-Name Bound-To
Segmentation fault


Program received signal SIGSEGV, Segmentation fault.
bfd_getl16 (p=0x1e63ad0) at ../../src/bfd/libbfd.c:559
559     ../../src/bfd/libbfd.c: No such file or directory.
        in ../../src/bfd/libbfd.c
(gdb) bt
#0  bfd_getl16 (p=0x1e63ad0) at ../../src/bfd/libbfd.c:559
#1  0x00000000004486b5 in pe_print_idata (abfd=0x1e67090, vfile=<value optimized
out>) at pex64igen.c:1302
#2  0x0000000000448fa1 in _bfd_pex64_print_private_bfd_data_common
(abfd=0x1e67090, vfile=0x2aaaaaaad000) at pex64igen.c:1976
#3  0x0000000000452449 in pe_print_private_bfd_data (abfd=0x1e63ad0,
vfile=0x2aaaaaaad000) at ../../src/bfd/peicode.h:335
#4  0x00000000004043bc in dump_bfd (abfd=0x1e67090) at
../../src/binutils/objdump.c:2440
#5  0x0000000000404bff in display_bfd (abfd=0x1e67090) at
../../src/binutils/objdump.c:3004
#6  0x0000000000404d48 in display_file (filename=0x7fffba1799b4 "a.exe",
target=<value optimized out>) at ../../src/binutils/objdump.c:3065
#7  0x000000000040534c in main (argc=3, argv=0x7fffba177868) at
../../src/binutils/objdump.c:3311

and the major thing, the a.exe doesn't work on winxp64.
it should print hello world but i see nothing on the windows console.
Comment 1 Pawel Sikora 2008-04-03 10:19:20 UTC
Created attachment 2347 [details]
testcase
Comment 2 Pawel Sikora 2008-04-03 10:22:09 UTC
$ x86_64-pc-mingw32-gcc -v
Using built-in specs.
Target: x86_64-pc-mingw32
Configured with: ../gcc/configure --prefix=/tmp/root-x86_64-pc-linux
--with-sysroot=/tmp/root-x86_64-pc-linux --target=x86_64-pc-mingw32
Thread model: win32
gcc version 4.4.0 20080402 (experimental) (GCC)


this is a mingw64 toolchain snapshot from sf.net.
Comment 3 Pawel Sikora 2008-04-03 11:15:19 UTC
Created attachment 2348 [details]
dep walker report.

the a.exe's import table looks broken.
Comment 4 Kai Tietz 2008-04-03 13:35:39 UTC
Created attachment 2349 [details]
Fix for problem

The rva's offset for IAT and thunk was not set to PE_IDATA4_SIZE or
PE_IDATA5_SIZE. This results in wrong values read on 4 byte offset.
Comment 5 Kai Tietz 2008-04-03 14:46:58 UTC
Committed at revision 1.103