[PATCH] rebase: fix 32-bit rollover

Yaakov (Cygwin/X) yselkowitz@users.sourceforge.net
Mon Feb 10 21:07:00 GMT 2014


When running rebase on multiple DLLs for x86, downwards rollover is now 
going back to the top of the 64-bit address space, which isn't right for 
x86 images.  This patch should restore the previous behaviour of rolling 
over (under?) to the top of the 32-bit space instead.  I didn't attempt 
to deal with upwards rollover due to the following comment.


Yaakov
-------------- next part --------------
Index: rebase.c
===================================================================
RCS file: /cvs/cygwin-apps/rebase/rebase.c,v
retrieving revision 1.20
diff -u -p -r1.20 rebase.c
--- rebase.c	1 Dec 2013 12:19:07 -0000	1.20
+++ rebase.c	10 Feb 2014 19:04:01 -0000
@@ -1063,6 +1063,12 @@ retry:
       return FALSE;
     }
 
+  /* handle 32-bit rollover */
+  if (down_flag
+      && machine == IMAGE_FILE_MACHINE_I386
+      && *new_image_base > 0xffffffff)
+    *new_image_base = 0x100000000L - new_image_size;
+
 #if defined(__CYGWIN__) || defined(__MSYS__)
   /* Avoid the case that a DLL is rebased into the address space taken
      by the Cygwin DLL.  Only test in down_flag == TRUE case, otherwise


More information about the Cygwin-apps mailing list