MingW-related setup.exe crash w/ DEP enabled

Charles Wilson cygwin@cwilson.fastmail.fm
Wed Mar 17 20:38:00 GMT 2010

Corinna wrote:
> Even if the crash is fixed now, you should better keep the old MingW
> version.  I tested the latest upx 3.04, and it still disallows to
> create compressed executables which have a .tls section.  I tried with
> a native Win32 build as well as with a Linux build of upx.

I guess I was confused by Corinna's original message. I thought she was
reporting a problem with upx and .tls, and another problem with dep +
.tls.  But my tests show that everything works fine -- on an XP box
without DEP.  So, is the problem is *only* dep + .tls? 

(My test results below, for the record...)


I just built setup.exe from today's CVS using

binutils             2.19.51-1
mingw-runtime        3.18-1
gcc-core             3.4.4-999
cygwin               1.7.1-1
upx                  3.01-1

and the uncompressed binary worked fine. It does have a .tls section:

$ objdump -p build/setup.exe

setup.exe:     file format pei-i386

Characteristics 0x107
        relocations stripped
        line numbers stripped
        32 bit words
The Data Directory
Entry 0 00000000 00000000 Export Directory [.edata (or where ever we
found it)]
Entry 1 001a8000 0000267c Import Directory [parts of .idata]
Entry 2 001ab000 00009134 Resource Directory [.rsrc]
Entry 3 00000000 00000000 Exception Directory [.pdata]
Entry 4 00000000 00000000 Security Directory
Entry 5 00000000 00000000 Base Relocation Directory [.reloc]
Entry 6 00000000 00000000 Debug Directory
Entry 7 00000000 00000000 Description Directory
Entry 8 00000000 00000000 Special Directory
Entry 9 00000000 00000000 Thread Storage Directory [.tls]
Entry a 00000000 00000000 Load Configuration Directory
Entry b 00000000 00000000 Bound Import Directory
Entry c 00000000 00000000 Import Address Table Directory
Entry d 00000000 00000000 Delay Import Directory
Entry e 00000000 00000000 CLR Runtime Header
Entry f 00000000 00000000 Reserved

After copying the binary over to my deployment area, and manually
running upx:

$ ls -l build/setup.exe
-rwxrwxr-x 1  15319826 2010-03-17 15:27 build/setup.exe

$ ls -l deploy/setup.exe
-rwxr-xr-x 1   4235538 2010-03-17 15:33 deploy/setup.exe

And it worked just fine.  I built using -O2 -g, but did not explicitly
strip the debug symbols.

Trying that....

$ cp build/setup.exe ./setup.exe
$ strip ./setup.exe
$ ls -l ./setup.exe
-rwxrwxr-x 1 1678848 2010-03-17 16:09 setup.exe

$ objdump -p ./setup.exe
./setup.exe:     file format pei-i386

Characteristics 0x30f
        relocations stripped
        line numbers stripped
        symbols stripped
        32 bit words
        debugging information removed
Entry 9 00000000 00000000 Thread Storage Directory [.tls]

....and the the stripped, but uncompressed, version worked just fine,
too.  Now, stripped AND uncompressed:

$ upx ./setup.exe
$ ls -l ./setup.exe
-rwxr-xr-x 1 655360 2010-03-17 16:10 setup.exe

....which also worked fine.


More information about the Cygwin-apps mailing list