X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Message-ID: <3759e04c0710051735ya99cb21ia51167aece7707ad@mail.gmail.com> Date: Fri, 5 Oct 2007 20:35:24 -0400 From: "Lynn Winebarger" To: cygwin AT cygwin DOT com Subject: Re: Bad EXE format (error 193) In-Reply-To: <3759e04c0710051734k77f4ab55ka83f63f751c9ad1e@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <3759e04c0710040726t61d47d00kb5b5103ed639152f AT mail DOT gmail DOT com> <014f01c80695$9db24960$2e08a8c0 AT CAM DOT ARTIMI DOT COM> <3759e04c0710040804r77c0917cs365e9066f86d29ee AT mail DOT gmail DOT com> <015f01c80699$cb83e200$2e08a8c0 AT CAM DOT ARTIMI DOT COM> <3759e04c0710041254h2f6f8b05jed2277d987b2c23a AT mail DOT gmail DOT com> <3759e04c0710041927m5b718e3bw9027ee77ef44ecf AT mail DOT gmail DOT com> <024c01c807a4$5c0b3b10$2e08a8c0 AT CAM DOT ARTIMI DOT COM> <3759e04c0710051734k77f4ab55ka83f63f751c9ad1e AT mail DOT gmail DOT com> X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com I forgot to cc the list, but the origin of the issue might be of interest to someone. On 10/5/07, Dave Korn wrote: > Well, this was a weird one. I think the underlying problem must be a bug in > larceny's final link stage during the build. First, this command made your > binary executable for me: > > objcopy -R .comment larceny.bin larceny2.exe > > [Detailed analysis omitted] > So, the file is regarded as malformed by the loader because it contains a > section that isn't correctly aligned to the file alignment. I don't know how > it got that way, but it's clearly inconsistent. It might be that the section > was supposed to have EXCLUDE or some other flag that would have made the > loader not care, I don't know, but since it's just a comment section, > discarding it with objdump -R does the job nicely. Thanks, Dave! With that information, I have tracked down the problem. The original Makefile uses "nasm -o foo.o foo.asm -f elf -g". I had subsequently changed this to "-f gnuwin32" (no -g), but the "make clean" did not actually erase that particular object file. The comment only appears in files made with -f elf and -g (at least, it doesn't appear with "-f gnuwin32 -g", or "-f win32 -g"). The section has alignment 2**0, compared to 2**2 of every other section. I'm surprised ld (or collect2, I don't know how different they are) did not at least complain about this if it wasn't willing to pad the section. Thanks, Lynn -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/