delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/04/28/15:09:15

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Wed, 28 Apr 2004 15:08:46 -0400
From: Christopher Faylor <cgf-no-personal-reply-please AT cygwin DOT com>
To: tbp <gcc AT ompf DOT org>, cygwin AT cygwin DOT com
Subject: Re: g++ 3.4.0 cygwin, codegen SSE & alignement issues
Message-ID: <20040428190846.GA9889@coe.bosbc.com>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: tbp <gcc AT ompf DOT org>, cygwin AT cygwin DOT com
References: <408F2C65 DOT 4090804 AT ompf DOT org> <Pine DOT CYG DOT 4 DOT 58 DOT 0404281232440 DOT 5560 AT fordpc DOT vss DOT fsi DOT com>
Mime-Version: 1.0
In-Reply-To: <Pine.CYG.4.58.0404281232440.5560@fordpc.vss.fsi.com>
User-Agent: Mutt/1.4.1i

On Wed, Apr 28, 2004 at 12:41:51PM -0500, Brian Ford wrote:
>On Wed, 28 Apr 2004, tbp wrote:
>
>> Building an app of mine (multithreaded) with something like -O3
>> -march=k8 the binary died with an illegal instruction. The offending
>> instruction was a 'movaps %xmm0, 0x40(%esp)' with an unaligned esp.
>> As that was on a secondary thread after some external calls (opengl and
>> so on) i thought it had to do with some cygwin/ABI issue or something.
>>
>> After a day of struggling/web digging, i still had no clue.
>[snip]
>> I'm puzzled & surprised that nobody tripped that one earlier and i'd
>> apreciate any clue.
>
>http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14776
>
>I'm working with Red Hat to resolve this issue right now.  The problem is
>that thread stacks are not always 16 byte aligned.  You could try the
>following hack if you need something right away and don't mind building
>your own Cygwin DLL.

This patch would only affect non-main threads.  It would not affect the
main thread.  Wouldn't you need to do the same thing for the main thread?
I don't understand why it would be different.

cgf

>2004-04-28  DJ Delorie  <dj AT redhat DOT com>
>
>        * init.cc (threadfunc_fe): Hack to make thread stacks always 16
>	byte aligned.
>
>Index: init.cc
>===================================================================
>RCS file: /cvs/src/src/winsup/cygwin/init.cc,v
>retrieving revision 1.32
>diff -u -p -r1.32 init.cc
>--- init.cc     22 Mar 2004 18:30:38 -0000      1.32
>+++ init.cc     28 Apr 2004 17:38:03 -0000
>@@ -27,6 +27,8 @@ HANDLE sync_startup;
> static void WINAPI
> threadfunc_fe (VOID *arg)
> {
>+  (void)__builtin_return_address(1);
>+  asm volatile ("andl $-16,%%esp" ::: "%esp");
>   _cygtls::call ((DWORD (*)  (void *, void *)) (((char **)
>_tlsbase)[OLDFUNC_OFFSET]), arg);
> }
>
>-- 
>Brian Ford
>Senior Realtime Software Engineer
>VITAL - Visual Simulation Systems
>FlightSafety International
>the best safety device in any aircraft is a well-trained pilot...
>
>--
>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/

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


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019