http://bugs.winehq.org/show_bug.cgi?id=10273
--- Comment #23 from Anastasius Focht focht@gmx.net 2007-11-08 18:01:23 --- Hello,
--- snip --- You are not by any chance running a distribution where -fstack-protector is enabled by default? Because compiling with that makes it work, too. --- snip ---
Not the case here. Gcc's stack smashing guard code won't solve this problem and additionally it applies only to certain classes of functions. Just an example, the following entry code was generated on my ix86 system with gcc version 4.1.2 20070925 (Red Hat 4.1.2-27) and -fstack-protector:
--- snip --- push ebp mov ebp, esp sub esp, 48h mov [ebp-0Ch], ebx call __i686_get_pc_thunk_bx add ebx, 4D866h mov [ebp-8], esi mov esi, eax mov [ebp-30h], edx mov eax, large gs:14h ; fetch random cookie from TLS mov [ebp-10h], eax ; setup stack guard xor eax, eax ; clear value ... --- snip ---
The stack cookie/guard setup code is inserted *after* PIC register load, so no help from compiler here.
--- snip --- btw. compiling with gcc-3.4.6 and it works right away. --- snip ---
Thats the problem. Different gcc compiler versions, different code generation (optimization techniques).
Regards