Problem with default manifest when application provides its own

Ken Brown kbrown@cornell.edu
Wed Apr 9 15:23:00 GMT 2014


I don't know if this report belongs here or if I should report a 
binutils bug, but I'll start here.

When building emacs-w32.exe with the current binutils, I end up with an 
executable that won't run after it's stripped (at least on x86_64).  I 
traced this to the fact that emacs-w32 comes with its own manifest.  My 
understanding is that the emacs-w32 manifest should take precedence over 
the Cygwin default manifest, but something's going wrong in this case.

Here's a simple test case to illustrate the problem, using a slight 
modification of the resource file that comes with emacs, and the 
corresponding manifest (see attached).

$ windres -O coff emacs.rc -o emacs.res

$ cat test.c
int main()
{
   return 0;
}

$ gcc -o test test.c -Wl,emacs.res

$ strip test.exe

$ ./test.exe
bash: ./test.exe: cannot execute binary file

The stripped binary has a messed up .rsrc section:

$ objdump -j .rsrc -s test.exe

test.exe:     file format pei-x86-64

Contents of section .rsrc:
objdump: Reading section failed


Ken
-------------- next part --------------
1 24 "emacs-x64.manifest"

#ifndef VS_VERSION_INFO
#define VS_VERSION_INFO 1
#endif

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 24,3,50,0
 PRODUCTVERSION 24,3,50,0
 FILEFLAGSMASK 0x3FL
#ifdef EMACSDEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x40004L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
	BLOCK "040904B0"
	BEGIN
	    VALUE "CompanyName", "Free Software Foundation\0"
	    VALUE "FileDescription", "GNU Emacs: The extensible self-documenting text editor\0"
	    VALUE "FileVersion", "24, 3, 50, 0\0"
	    VALUE "InternalName", "Emacs\0"
	    VALUE "LegalCopyright", "Copyright (C) 2001-2014\0"
	    VALUE "OriginalFilename", "emacs.exe"
	    VALUE "ProductName", "Emacs\0"
	    VALUE "ProductVersion", "24, 3, 50, 0\0"
	    VALUE "OLESelfRegister", "\0"
	 END
     END
     BLOCK "VarFileInfo"
     BEGIN
         VALUE "Translation", 0x409, 1200
     END
END
-------------- next part --------------
A non-text attachment was scrubbed...
Name: emacs-x64.manifest
Type: text/xml
Size: 1349 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20140409/a8081605/attachment.xml>
-------------- next part --------------
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


More information about the Cygwin mailing list