[PATCH/rebase] x86_64 Cygwin (was Re: [PATCH 0/2 rebase] Handle CPAN/etc. DLLs in rebaseall)

Corinna Vinschen corinna-cygwin@cygwin.com
Wed Feb 13 09:42:00 GMT 2013


On Feb 12 20:24, Jason Tishler wrote:
> On Tue, Feb 12, 2013 at 12:01:52PM +0100, Corinna Vinschen wrote:
> > On Feb 12 04:19, Yaakov wrote:
> > > Then the conf.d could be in addition to my patch, in which case my
> > > patch is just avoiding the need for the packages in question to
> > > state that which we already know.
> > 
> > I'm ok with that, but ultimately it's Jason's call.
> 
> I'm fine with the above too.  Let me know when your patches are
> committed and I will release rebase.

Here's a preliminary patch for 64 bit Cygwin.  We might drop the cyg64
prefix again, though, so maybe this is more for the records than for
actually checking in.

But it also contains a small patch for 32 bit Cygwin:  Subtracting 3 *
ALLOCATION_SLOT from cygwin_dll_image_base was not quite correct, since
there are potentially four shared mem regions.  The below patch fixes
that as well.


Corinna


	* rebaseall.in: Take x86_64 Cygwin into account.
	* rebase.c (CYGWIN_DLL): Define for x86_64 Cygwin.
	(main): Fix computation of 32 bit Cygwin DLL dead zone.
	Handle x86_64 Cygwin as well.


Index: rebaseall.in
===================================================================
RCS file: /sourceware/projects/cygwin-apps-home/cvsfiles/rebase/rebaseall.in,v
retrieving revision 1.9
diff -u -p -r1.9 rebaseall.in
--- rebaseall.in	7 Jun 2012 18:50:33 -0000	1.9
+++ rebaseall.in	13 Feb 2013 09:38:18 -0000
@@ -88,6 +88,15 @@ case $Platform in
     ;;
 esac
 
+# On x86_64 Cygwin, set DefaultAddressBase to 0x4:00000000
+case $Platform in
+  cygwin )
+    [ `uname -m` = "x86_64" ] && DefaultBaseAddress=0x400000000
+    ;;
+  * )
+    ;;
+esac
+  
 # Parse command line arguments
 while getopts "${ProgramOptions}" Option "$@"
 do
Index: rebase.c
===================================================================
RCS file: /sourceware/projects/cygwin-apps-home/cvsfiles/rebase/rebase.c,v
retrieving revision 1.17
diff -u -p -r1.17 rebase.c
--- rebase.c	16 Jan 2013 16:15:40 -0000	1.17
+++ rebase.c	13 Feb 2013 09:38:18 -0000
@@ -111,7 +111,11 @@ ULONG cygwin_dll_image_size = 0;
 #if defined(__MSYS__)
 # define CYGWIN_DLL "/usr/bin/msys-1.0.dll"
 #elif defined (__CYGWIN__)
-# define CYGWIN_DLL "/usr/bin/cygwin1.dll"
+# ifdef __x86_64__
+#  define CYGWIN_DLL "/usr/bin/cyg64win1.dll"
+# else
+#  define CYGWIN_DLL "/usr/bin/cygwin1.dll"
+# endif
 #endif
 
 #define LONG_PATH_MAX 32768
@@ -163,15 +167,23 @@ main (int argc, char *argv[])
 	 into the memory area taken by the Cygwin DLL. */
       GetImageInfos64 ("/bin/cygwin1.dll", NULL,
 		       &cygwin_dll_image_base, &cygwin_dll_image_size);
-      /* Take the three shared memory areas preceeding the DLL into account. */
-      cygwin_dll_image_base -= 3 * ALLOCATION_SLOT;
+      /* Take the up to four shared memory areas preceeding the DLL into
+      	 account. */
+      cygwin_dll_image_base -= 4 * ALLOCATION_SLOT;
       /* Add a slack of 8 * 64K at the end of the Cygwin DLL.  This leave a
 	 bit of room to install newer, bigger Cygwin DLLs, as well as room to
 	 install non-optimized DLLs for debugging purposes.  Otherwise the
 	 slightest change might break fork again :-P */
-      cygwin_dll_image_size += 3 * ALLOCATION_SLOT + 8 * ALLOCATION_SLOT;
+      cygwin_dll_image_size += 4 * ALLOCATION_SLOT + 8 * ALLOCATION_SLOT;
     }
-#endif
+  else
+    {
+      /* On x86_64 Cygwin, we want to keep free the whole 2 Gigs area in which
+	 the Cygwin DLL resides, no matter what. */
+      cygwin_dll_image_base = 0x180000000L;
+      cygwin_dll_image_size = 0x080000000L;
+    }
+#endif /* __CYGWIN__ */
 
   /* Collect file list, if specified. */
   if (file_list)


-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat



More information about the Cygwin-apps mailing list