delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/09/01/11:25:58

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Mon, 1 Sep 2008 11:25:14 -0400
From: Christopher Faylor <cgf-use-the-mailinglist-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: why the strange stack stuf in cygwin?
Message-ID: <20080901152514.GA1833@ednor.casa.cgf.cx>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <COL101-W27B90ED300AD81D50B68A0E65C0 AT phx DOT gbl>
MIME-Version: 1.0
In-Reply-To: <COL101-W27B90ED300AD81D50B68A0E65C0@phx.gbl>
User-Agent: Mutt/1.5.16 (2007-06-09)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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

On Mon, Sep 01, 2008 at 08:33:16AM +0000, Jay wrote:
> Why does Cygwin do such wierd stuff with the top of the stack?
> Is this to have thread locals faster than TlsGetValue offers?

No, it is a work-around for this:

  % cat <<'EOF' > foo.c
  __thread int abc;

  int
  main (int argc, char **argv)
  {
    printf ("%d\n", abc);
  }
  EOF

  % gcc -o foo foo.c
  foo.c:2: error: thread-local storage not supported for this target

> Is it worth it?

What kind of answer do you expect here?  A head slap and a "What were we
thinking???"

> (The cost: harder to LoadLibrary(cygwin1.dll),

Dynamic linking of cygwin1.dll (i.e., making it easier to be a 3PP) has never
been a core goal of Cygwin.

>harder to port to other architectures,

Cygwin works on all of the architectures that Windows NT+ supports.
Porting Cygwin to architectures supported by Windows CE would require
quite a bit more work than fiddling with the thread local storage model.

>the strange path where DllMain "respawns", etc.)

"the strange path"?

You're using shorthand which assumes that people understand your thought
processes and conclusions.  If you have a point to make you really need
to provide more details and concrete examples of an alternate method for
doing what is currently accomplished by Cygwin's tls method.

cgf

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