This is the mail archive of the cygwin mailing list for the Cygwin 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]

Problem with default manifest when application provides its own


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

Attachment: emacs.rc
Description: Text document

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls"
                        version="6.0.0.0" processorArchitecture="AMD64"
                        publicKeyToken="6595b64144ccf1df"
                        language="*"/>
    </dependentAssembly>
  </dependency>
  <assemblyIdentity version="1.0.0.0" processorArchitecture="AMD64"
		    name="emacs" type="win32"/>
  <description>GNU Emacs</description>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="asInvoker"/>
      </requestedPrivileges>
    </security>
  </trustInfo>
    <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> 
      <application> 
         <!-- Windows 8.1 -->
         <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
         <!-- Windows Vista -->
         <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> 
         <!-- Windows 7 -->
         <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
         <!-- Windows 8 -->
         <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
      </application> 
    </compatibility>
</assembly>

--
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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]