From: gunther DOT ebert AT ixos-leipzig DOT de (Gunther Ebert) Subject: Re: Bad executable and stripped/unstripped exes 6 Apr 1997 23:30:58 -0700 Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <334895E8.6532.cygnus.gnu-win32@ixos-leipzig.de> References: Reply-To: gunther DOT ebert AT ixos-leipzig DOT de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.0b2 (WinNT; I) Original-To: root , gnu-win32 AT cygnus DOT com X-Priority: 3 (Normal) Original-Sender: owner-gnu-win32 AT cygnus DOT com root wrote: Guenther was kind enough to send me an executable that doesn't work. The problem seems to be that the sections of the executable are not in ascending order: We have First text, bss and data sections. So far all OK. text is at 4096 0x1000 bss is at 8192 0x2000 data is at 12288 0x3000 then we have the .stab and the .stabstr sections. .stab at 24576 0x6000 .stabstr at 28672 0x7000 and THEN the resources section. .rsrc at 20480 0x5000 The system expects a contiguous image. Since the type of the debug info is 'NOT LOADABLE' this would leave a hole in the image and the system refuses to load a thing like that. Fixes: 1 Change the type of the stabs section from 'NOT LOADABLE' to LOADABLE. This horrible hack would multiply your memory consumption with a lot of strings like: /pizza/mushroom/noer/beta17/build and many other funny things... (By the way noer, we all know you like mushroom pizza by now... I think it is NOT necessary to write it in all executables produced by gcc...:-) The debug section would be loaded into memory, but since there are no pointers to it this would be harmless. Of course, instead of having a memory usage of say, 300K, your program would occupy maybe 3MB. 2 Fix ld. The resources section should come after the data section in the header. This is a MAJOR undertaking however. But I have an idea. ... It must be something else. Last night I compiled the GNU compiler tools with mingw32 (it was much less effort than you would expect to get it working) and voila - gcc produced executables which - run without being stripped even under NT 4.0 - can even contain resources - can even be debugged with gdb Interesting, isn't it? -- Gunther Ebert iXOS Anwendungs-Software GmbH Angerstrasse 40-42 D-04177 Leipzig Phone : +49 341 48503-0 Fax : +49 341 48503-99 E-mail: mailto:gunther DOT ebert AT ixos-leipzig DOT de www : http://www.ixos-leipzig.de - For help on using this list, send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".