public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: _dll_crt0: minimize target-specific conditional code
Date: Thu, 14 Jul 2022 18:09:27 +0000 (GMT)	[thread overview]
Message-ID: <20220714180927.B77C33858C54@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=5192d5ea51dee786ba1cb97b216bd40115dbbf20

commit 5192d5ea51dee786ba1cb97b216bd40115dbbf20
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Thu Jul 14 20:08:58 2022 +0200

    Cygwin: _dll_crt0: minimize target-specific conditional code
    
    Only the assembler snippet is really x86_64-specific, so minimize the
    conditional code block to this snippet.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/dcrt0.cc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 897a2fba3..97eefa19d 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -1016,7 +1016,6 @@ __cygwin_exit_return:			\n\
 extern "C" void __stdcall
 _dll_crt0 ()
 {
-#ifdef __x86_64__
   /* Starting with Windows 10 rel 1511, the main stack of an application is
      not reproducible if a 64 bit process has been started from a 32 bit
      process.  Given that we have enough virtual address space on 64 bit
@@ -1033,6 +1032,7 @@ _dll_crt0 ()
 	  PVOID stackaddr = create_new_main_thread_stack (allocationbase);
 	  if (stackaddr)
 	    {
+#ifdef __x86_64__
 	      /* Set stack pointer to new address.  Set frame pointer to
 	         stack pointer and subtract 32 bytes for shadow space. */
 	      __asm__ ("\n\
@@ -1040,6 +1040,9 @@ _dll_crt0 ()
 		       movq  %%rsp, %%rbp  \n\
 		       subq  $32,%%rsp     \n"
 		       : : [ADDR] "r" (stackaddr));
+#else
+#error unimplemented for this target
+#endif
 	      /* We're on the new stack now.  Free up space taken by the former
 		 main thread stack and set DeallocationStack correctly. */
 	      VirtualFree (NtCurrentTeb ()->DeallocationStack, 0, MEM_RELEASE);
@@ -1049,9 +1052,6 @@ _dll_crt0 ()
       else
 	fork_info->alloc_stack ();
     }
-#else
-#error unimplemented for this target
-#endif
 
   fesetenv (FE_DFL_ENV);
   _main_tls = &_my_tls;


                 reply	other threads:[~2022-07-14 18:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220714180927.B77C33858C54@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).