OSDN Git Service

* Makefile.in: Warn when end of cygheap is not on 64k boundary.
authorcgf <cgf>
Sun, 7 Aug 2005 02:38:13 +0000 (02:38 +0000)
committercgf <cgf>
Sun, 7 Aug 2005 02:38:13 +0000 (02:38 +0000)
* cygwin.sc: Try harder to ensure that cygheap is on a 64k boundary.  Move
cygheap to end of image to stop interference from unstripped debug regions.

winsup/cygwin/ChangeLog
winsup/cygwin/Makefile.in
winsup/cygwin/cygwin.sc
winsup/cygwin/dcrt0.cc

index 1bc93e2..064f21f 100644 (file)
@@ -1,5 +1,12 @@
 2005-08-06  Christopher Faylor  <cgf@timesys.com>
 
+       * Makefile.in: Warn when end of cygheap is not on 64k boundary.
+       * cygwin.sc: Try harder to ensure that cygheap is on a 64k boundary.
+       Move cygheap to end of image to stop interference from unstripped debug
+       regions.
+
+2005-08-06  Christopher Faylor  <cgf@timesys.com>
+
        * include/endian.h: Move everything into this file and define things
        more like linux.
        * include/cygwin/types.h: Include endian.h.
index 087289b..9949a1e 100644 (file)
@@ -372,6 +372,12 @@ $(TEST_DLL_NAME): $(LDSCRIPT) $(DLL_OFILES) $(DLL_IMPORTS) $(LIBSERVER) $(LIBC)
        -e $(DLL_ENTRY) $(DEF_FILE) $(DLL_OFILES) version.o winver.o \
        $(MALLOC_OBJ) $(LIBSERVER) $(LIBM) $(LIBC) \
        -lgcc $(DLL_IMPORTS)
+       @$(NM) $@ | perl -Minteger -n -e '/^(61[0-9a-f]+) A __cygheap_end/ and do {$$cygheap_end = $$1; exit;};\
+           END { \
+               die "ERROR: _cygheap_end not found in $@\n" unless defined($$cygheap_end); \
+               die "ERROR: _cygheap_end is not on a 64k boundary (0x$$cygheap_end)!\n" if (hex($$cygheap_end) & 0xffff);\
+               exit 0; \
+           }'
        @ln -f $@ new-$(DLL_NAME)
 
 # Rule to build libcygwin.a
index 9270ab5..e2a83d0 100644 (file)
@@ -70,30 +70,6 @@ SECTIONS
   {
     *(.cygwin_dll_common)
   }
-  .idata ALIGN(__section_alignment__) :
-  {
-    /* This cannot currently be handled with grouped sections.
-       See pe.em:sort_sections.  */
-    SORT(*)(.idata$2)
-    SORT(*)(.idata$3)
-    /* These zeroes mark the end of the import list.  */
-    LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
-    SORT(*)(.idata$4)
-    SORT(*)(.idata$5)
-    SORT(*)(.idata$6)
-    SORT(*)(.idata$7)
-    . = ALIGN(16);
-    __cygheap_start = ABSOLUTE(.);
-  }
-  .cygheap ALIGN(__section_alignment__):
-  {
-    __cygheap_mid = .;
-    *(.cygheap)
-    . = ALIGN(512 * 1024, 0x10000);
-    . += 8192;         /* inexplicably needed for alignment on 64K boundary?!? */
-  }
-  __cygheap_end = ABSOLUTE(.);
-  __cygheap_end1 = __cygheap_mid + SIZEOF(.cygheap);
   /DISCARD/ :
   {
     *(.debug$S)
@@ -122,4 +98,28 @@ SECTIONS
   .debug_macinfo  ALIGN(__section_alignment__) (NOLOAD) : { *(.debug_macinfo) }
   .debug_macinfo  ALIGN(__section_alignment__) (NOLOAD) : { *(.debug_macinfo) }
   .debug_ranges   ALIGN(__section_alignment__) (NOLOAD) : { *(.debug_ranges) }
+  .idata ALIGN(__section_alignment__) :
+  {
+    /* This cannot currently be handled with grouped sections.
+       See pe.em:sort_sections.  */
+    SORT(*)(.idata$2)
+    SORT(*)(.idata$3)
+    /* These zeroes mark the end of the import list.  */
+    LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
+    SORT(*)(.idata$4)
+    SORT(*)(.idata$5)
+    SORT(*)(.idata$6)
+    SORT(*)(.idata$7)
+    . = ALIGN(16);
+    __cygheap_start = ABSOLUTE(.);
+    . = ALIGN(0x10000);
+  }
+  .cygheap ALIGN(__section_alignment__) :
+  {
+    __cygheap_mid = .;
+    *(.cygheap)
+    . = ALIGN(512 * 1024, 0x10000);
+  }
+  __cygheap_end = ABSOLUTE(.);
+  __cygheap_end1 = __cygheap_mid + SIZEOF(.cygheap);
 }
index 9fd9fa8..4286dd3 100644 (file)
@@ -725,6 +725,9 @@ dll_crt0_1 (char *)
 
   check_sanity_and_sync (user_data);
   malloc_init ();
+  int i = 0;
+  while (i)
+    cmalloc (HEAP_STR, 2000000);
 
   /* Initialize SIGSEGV handling, etc. */
   init_exceptions (&cygwin_except_entry);