This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
While trying to add DWARF2 support to Cygwin/mingw, I came accross the following buglet: After compiling and linking a Cygwin app with DWARF2, executing the app fails with: -bash: ./app: Permission denied ls -l app.exe -rwxr-xr-x 1 ford None 17876798 Mar 21 17:11 app.exe* strace ./app.exe strace.exe: error creating process app.exe, (error 193) MSDN says error 193 is: ERROR_BADE_EXE_FORMAT: %1 is not a valid Win32 application I stumbled on to the fact that objcopy app.exe fixes it. The file size grows to: -rwxr-xr-x 1 ford None 17898525 Mar 21 17:11 app.exe* Diffing objdump -x shows (amoung other things): -SizeOfImage 0194d000 -SizeOfHeaders 00000400 -CheckSum 0111987e +SizeOfImage 0194c000 +SizeOfHeaders 00000000 +CheckSum 0110d9f8 Hmm..., SizeOfHeaders is output from peXXigen.c (_bfd_XXi_swap_aouthdr_out). It is assumed to be the same as the file offset of the first section (aligned to the section alignment, although, shouldn't that already be reflected there by definition?). Anyway, setting a break point there showed the first section to be one I had accidentally left out of the linker script (.debug_ranges, an orphan) with a file offset of 0. Looking at the output of objdump -h shows that alloc only sections also have a zero file offset. So, 2004-03-24 Brian Ford <ford@vss.fsi.com> * peXXigen.c (_bfd_XXi_swap_aouthdr_out): Orphan and alloc only sections can have a filepos of 0, so use the first non-zero filepos for the SizeOfHeaders field. -- Brian Ford Senior Realtime Software Engineer VITAL - Visual Simulation Systems FlightSafety International Phone: 314-551-8460 Fax: 314-551-8444
Attachment:
pe_SizeOfHeaders.patch
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |