Bug 6026 - objdump craches on simple *.exe / application doesn't work.
Summary: objdump craches on simple *.exe / application doesn't work.
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.18
: P2 normal
Target Milestone: ---
Assignee: Kai Tietz
Depends on:
Reported: 2008-04-03 10:18 UTC by Pawel Sikora
Modified: 2008-04-03 14:46 UTC (History)
1 user (show)

See Also:
Host: x86_64-gnu-linux
Target: x86_64-pc-mingw32
Last reconfirmed:

testcase (38.40 KB, application/octet-stream)
2008-04-03 10:19 UTC, Pawel Sikora
dep walker report. (27.20 KB, image/png)
2008-04-03 11:15 UTC, Pawel Sikora
Fix for problem (244 bytes, patch)
2008-04-03 13:35 UTC, Kai Tietz
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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
#5  0x0000000000404bff in display_bfd (abfd=0x1e67090) at
#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

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]
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