delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/01/06/20:18:14

Message-Id: <000601bd1b0a$193f1770$45111d0f@ros51675cra.rose.hp.com>
From: "Andrew Crabtree" <andrewc AT rosemail DOT rose DOT hp DOT com>
To: "DJ Delorie" <dj AT delorie DOT com>
Cc: <djgpp-workers AT delorie DOT com>
Subject: Re: Stack Alignment
Date: Tue, 6 Jan 1998 17:18:01 -0800
Mime-Version: 1.0

>> I figured out that the stack wasn't being aligned before the
>Yup, I've got that patch already.
I don't think I understand.  I pulled down 'djlsr202' from the 980101
directory
on simtelnet and it doesn't appear that the stack is being aligned in
crt1.c.
Do you mean you got the patch and haven't or won't install it or is it just
an oversite?

Here's a diff against the latest alpha if it is the latter.

Andy

--- crt1.old Mon Dec 29 17:09:42 1997
+++ crt1.c Tue Jan  6 17:11:02 1998
@@ -167,6 +167,20 @@
   _npxsetup(pn);
   _crt0_init_mcount();
   __main();
-  exit(main(__crt0_argc, __crt0_argv, environ));
+  /* Inline assembly for the following statement plus align the stack to
+   * a double
+   *
+   * exit(main(__crt0_argc, __crt0_argv, environ));
+   */
+  asm("
+       andl $0xFFFFFFF8,%%esp
+       pushl %%eax
+       pushl %0
+       pushl %1
+       pushl %2
+       call _main
+       pushl %%eax
+       call _exit
+      " :: "m" (environ), "m" (__crt0_argv), "m" (__crt0_argc));
 }




- Raw text -


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