Mail Archives: cygwin/2004/04/28/11:18:29
Ross Ridge wrote:
> Normally it's not a problem, but if you have any callbacks in your code
> (eg. the one that starts the secondary thread) that are called by library
> functions not compiled with GCC, then the stack can get misaligned.
Every library under my control were recompiled with gcc3.4 and more
specifically SDL that i used to spawn those threads.
My code when it has alignement requirement tells the compiler about; the
trouble is in that case that gcc emited sse instructions with 16byte
requirement on its own without further checkings.
GCC 3.3.1 works like a charm when using fpmath=sse on the same source,
tho i haven't seen it emitting memory references in conjunction with *ps
instructions.
> It's an ABI incompatiblity issue, GCC expects a 16-byte aligned stack,
> but the Windows ABI, to the extent one actually exists, only assumes
> a 4-byte aligned stack (and even that's not a strict requirement).
Is there an official or semi official way to fix it or do i have to
insert something like "mov esp, eax; and 0x15, eax; sub eax, esp" where
it helps?
> This is a GCC and/or Binutils (as/ld) bug. GCC puts constants in the
> ".rdata" section, but this section only 4-byte aligned.
Indeed.
Alejandro López-Valencia wrote:
> Or, instead, add -mms-bitfields -malign-double to your CFLAGS and
> -Wl,--fdata-sections to your LDFLAGS sectiion. It may or may not work
> but at least the failure will be different.
I've already tried -malign-double -fdata-sections. In fact i've tried
every option remotly related to alignment under sun (but -mms-bitfields
that i didn't know about) to no avail.
As a side note gcc 3.3.1 acts funny sometimes with -ffunction-sections
-fdata-sections for cygwin/ming at link time when dealing with lots of
objects.
> Well, that makes the workaround simple, just use the "-mno-sse",
> "-mno-sse2" options, don't use the "-mfpmath=sse" option and GCC shouldn't
> generate any SSE1/2 instructions.
Or i could use gcc 3.3.1. Or use another compiler.
I understand -mfpmath=sse is flagged as experimental. What i don't get
is why the compiler emits totally bogus code when using default
switches: -O3 -march=k8 -> boom. -O3 -march=pentium4 -> boom.
I guess this has little to do with cygwin per se and i'm gonna file a
bugreport to let the gcc ppl know.
Thanks for your time.
tbp
PS: I've never found out how to build a 'cygming special' binary from
gcc sources, i can only make a cygwin or mingw. What's the trick?
--
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/
- Raw text -