* child_info.h (child_info::cygheap_h): Delete.

(child_info::dwProcessId): New field.
* cygheap.cc (init_cheap): Delete.
(dup_now): Ditto.
(cygheap_setup_for_child): Ditto.
(cygheap_setup_for_child_cleanup): Ditto.
(cygheap_fixup_in_child): Simplify.  Use new "child_copy" function to copy heap
from parent.
(_csbrk): Don't attempt allocation if within cygheap section.  Fix so that more
than one allocation will succeed.
(cygheap_init): Reset possibly-nonzero region to zero.
* cygheap.h (cygheap_setup_for_child): Delete declaration.
(cygheap_setup_for_child_cleanup): Ditto.
(cygheap_start): Define as an array.
* cygwin.sc: Modernize.  Remove unneeded sections.  Define cygheap here.
* dcrt0.cc (do_exit): Reflect argument change to close_all_files.
* dtable.cc (dtable::vfork_parent_restore): Ditto.
* dtable.h: Ditto.
* fhandler.h: Ditto.
* fork.cc (fork_copy): Call ReadProcessMemory if there is no thread
(indicating that we're execing).
(fork_child): Don't mess with hParent.
(fork_parent): Remove hParent stuff.  It happens earlier now.  Remove call to
cygheap_setup_for_child* stuff.
(fork): Put child_info_stuff in grouped structure.  Issue error if parent
handle is not set.
(child_copy): New function.
* sigproc.cc (child_info::child_info): Put cygheap settings here.  Set parent
handle.
(child_info::~child_info): Close parent handle if it exists.
* spawn.cc (spawn_guts): Reorganize so that ciresrv is allocated at only the
last minute so that cygheap changes are reflected.  Delete cygheap_setup*
calls.
* syscalls.cc (close_all_files): Add an argument to flag when the fd entry
should be released.
* winsup.h (close_all_files): Add an argument to close_all_files declaration.
Declare child_copy.
This commit is contained in:
Christopher Faylor
2005-06-01 03:46:56 +00:00
parent 302cb8165e
commit ce95c6407e
14 changed files with 202 additions and 280 deletions

View File

@@ -1,6 +1,4 @@
OUTPUT_FORMAT(pei-i386)
SEARCH_DIR(/cygnus/i686-pc-cygwin/lib/w32api); SEARCH_DIR(/cygnus/i686-pc-cygwin/lib);
ENTRY(_mainCRTStartup)
SECTIONS
{
.text __image_base__ + __section_alignment__ :
@@ -10,9 +8,9 @@ SECTIONS
*(SORT(.text$*))
*(.glue_7t)
*(.glue_7)
___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
___CTOR_LIST__ = .; __CTOR_LIST__ = .;
LONG (-1); *(SORT(.ctors.*)); *(.ctors); *(.ctor); LONG (0);
___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
___DTOR_LIST__ = .; __DTOR_LIST__ = .;
LONG (-1); *(SORT(.dtors.*)); *(.dtors); *(.dtor); LONG (0);
*(.fini)
/* ??? Why is .gcc_exc here? */
@@ -20,38 +18,42 @@ SECTIONS
etext = .;
*(.gcc_except_table)
}
.autoload_text ALIGN(__section_alignment__) :
{
*(.*_text);
}
/* The Cygwin DLL uses a section to avoid copying certain data
on fork. This used to be named ".data". The linker used
to include this between __data_start__ and __data_end__, but that
breaks building the cygwin32 dll. Instead, we name the section
".data_cygwin_nocopy" and explictly include it after __data_end__. */
.data BLOCK(__section_alignment__) :
.data ALIGN(__section_alignment__) :
{
__data_start__ = . ;
__data_start__ = .;
*(.data)
*(.data2)
*(SORT(.data$*))
__data_end__ = . ;
__data_end__ = .;
*(.data_cygwin_nocopy)
}
.rdata BLOCK(__section_alignment__) :
.rdata ALIGN(__section_alignment__) :
{
*(.rdata)
*(SORT(.rdata$*))
*(.eh_frame)
}
.pdata BLOCK(__section_alignment__) :
.pdata ALIGN(__section_alignment__) :
{
*(.pdata)
}
.bss BLOCK(__section_alignment__) :
.bss ALIGN(__section_alignment__) :
{
__bss_start__ = . ;
__bss_start__ = .;
*(.bss)
*(COMMON)
__bss_end__ = . ;
__bss_end__ = .;
}
.edata BLOCK(__section_alignment__) :
.edata ALIGN(__section_alignment__) :
{
*(.edata)
}
@@ -62,7 +64,28 @@ SECTIONS
*(.debug$F)
*(.drectve)
}
.idata BLOCK(__section_alignment__) :
.stab ALIGN(__section_alignment__) (NOLOAD) :
{
[ .stab ]
}
.stabstr ALIGN(__section_alignment__) (NOLOAD) :
{
[ .stabstr ]
}
/* DWARF 1.1 and DWARF 2 */
.debug_aranges ALIGN(__section_alignment__) (NOLOAD) : { *(.debug_aranges) }
.debug_pubnames ALIGN(__section_alignment__) (NOLOAD) : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info ALIGN(__section_alignment__) (NOLOAD) : { *(.debug_info) }
.debug_abbrev ALIGN(__section_alignment__) (NOLOAD) : { *(.debug_abbrev) }
.debug_line ALIGN(__section_alignment__) (NOLOAD) : { *(.debug_line) }
.debug_frame ALIGN(__section_alignment__) (NOLOAD) : { *(.debug_frame) }
.debug_str ALIGN(__section_alignment__) (NOLOAD) : { *(.debug_str) }
.debug_loc ALIGN(__section_alignment__) (NOLOAD) : { *(.debug_loc) }
.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. */
@@ -74,51 +97,17 @@ SECTIONS
SORT(*)(.idata$5)
SORT(*)(.idata$6)
SORT(*)(.idata$7)
. = ALIGN(16);
__cygheap_start = ABSOLUTE(.);
}
.CRT BLOCK(__section_alignment__) :
osection_alignment = __section_alignment__;
__section_alignment__ = 64 * 1024;
.cygheap ALIGN(4096):
{
*(SORT(.CRT$*))
}
.endjunk BLOCK(__section_alignment__) :
{
/* end is deprecated, don't use it */
end = .;
_end = .;
__end__ = .;
}
.rsrc BLOCK(__section_alignment__) :
{
*(.rsrc)
*(SORT(.rsrc$*))
}
.reloc BLOCK(__section_alignment__) :
{
*(.reloc)
}
.stab BLOCK(__section_alignment__) (NOLOAD) :
{
[ .stab ]
}
.stabstr BLOCK(__section_alignment__) (NOLOAD) :
{
[ .stabstr ]
}
/* DWARF 1.1 and DWARF 2 */
.debug_aranges BLOCK(__section_alignment__) (NOLOAD) : { *(.debug_aranges) }
.debug_pubnames BLOCK(__section_alignment__) (NOLOAD) : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info BLOCK(__section_alignment__) (NOLOAD) : { *(.debug_info) }
.debug_abbrev BLOCK(__section_alignment__) (NOLOAD) : { *(.debug_abbrev) }
.debug_line BLOCK(__section_alignment__) (NOLOAD) : { *(.debug_line) }
.debug_frame BLOCK(__section_alignment__) (NOLOAD) : { *(.debug_frame) }
.debug_str BLOCK(__section_alignment__) (NOLOAD) : { *(.debug_str) }
.debug_loc BLOCK(__section_alignment__) (NOLOAD) : { *(.debug_loc) }
.debug_macinfo BLOCK(__section_alignment__) (NOLOAD) : { *(.debug_macinfo) }
.debug_macinfo BLOCK(__section_alignment__) (NOLOAD) : { *(.debug_macinfo) }
.debug_ranges BLOCK(__section_alignment__) (NOLOAD) : { *(.debug_ranges) }
.cygheap BLOCK(64 * 1024) :
{
__system_dlls__ = ABSOLUTE(.) ;
__cygheap_start = ABSOLUTE(.) ;
__cygheap_mid = .;
. = ALIGN(512 * 1024, 0x10000);
. += 8192; /* inexplicably needed for alignment on 64K boundary?!? */
_cygheap_foo = .;
}
__cygheap_end = ABSOLUTE(.);
}