Mail Archives: cygwin/1997/07/16/13:18:18
Recently, a user of 'res2coff' sent me a program that would not load under
windows NT. He thought that the bug was the fault of 'res2coff'.
I have repeatedly reported this bug in this list, but I have never tried to
make the executable WORK by mdofiying it with my binary editor. I did that,
and the executable now loads without problems, confirming the theory I have
about this bug:
This happens because 'ld' gets confused with the addresses of each section,
and leaves GAPS between the sections, in the image layout. Those GAPS make
that NT's loader refuses to load the executable.
Here is the original section layout as reported with 'pedump' a binary dump
utility that comes with the 'lcc' package.
Section Table
01 .text VirtSize: 00106304 VirtAddr: 00004096 0x00001000
raw data offs: 01024 raw data size: 106496
02 .bss VirtSize: 00005308 VirtAddr: 00110592 0x0001b000
raw data offs: 00000 raw data size: 00000
03 .data VirtSize: 00015352 VirtAddr: 00118784 0x0001d000 (1b000+2pages)
raw data offs: 107520 raw data size: 15360
04 .idata VirtSize: 00003180 VirtAddr: 00135168 0x00021000 (1d000+4pages)
raw data offs: 122880 raw data size: 03584
05 .stab VirtSize: 00000960 VirtAddr: 00147456 0x00024000 <<< gap!!!
raw data offs: 126464 raw data size: 01024 this should
relocation offs: 00000000 relocations: 00000000 be 23000!!!
06 .stabstr VirtSize: 00003093 VirtAddr: 00151552 0x00025000 and the error
raw data offs: 127488 raw data size: 03584 propagates
to the other
07 .rsrc VirtSize: 00005594 VirtAddr: 00139264 0x00022000 sections after
raw data offs: 131072 raw data size: 05632 the wrong one
You can see that between the idata and the next section, the stab section,
there is a gap of 16K, but the idata section makes only for 3584 bytes,
i.e. only one page (4096) bytes.
To test this hypothesis I changed the positions of all sections to
make them consecutive using lcc's binary editor. I moved
The stab section to 139264 (0x22000)
The stabstr section to 143360 (0x23000)
The rsrc section to 147456 (0x24000)
and now your executable runs. I can't go on testing it since I do not have
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cygwin.dll
This is a bug in the linker, 'ld'.
--
Jacob Navia Logiciels/Informatique
41 rue Maurice Ravel Tel 01 48.23.51.44
93430 Villetaneuse Fax 01 48.23.95.39
France
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -