Index: cygwin.din =================================================================== RCS file: /cvs/uberbaum/winsup/cygwin/cygwin.din,v retrieving revision 1.62 diff -u -p -2 -r1.62 cygwin.din --- cygwin.din 30 Aug 2002 13:30:26 -0000 1.62 +++ cygwin.din 3 Sep 2002 06:25:51 -0000 @@ -148,4 +148,5 @@ dll_noncygwin_dllcrt0 cygwin_detach_dll cygwin32_detach_dll = cygwin_detach_dll +_pei386_runtime_relocator @DEF_DLL_ENTRY@ drem Index: cygwin.sc =================================================================== RCS file: /cvs/uberbaum/winsup/cygwin/cygwin.sc,v retrieving revision 1.7 diff -u -p -2 -r1.7 cygwin.sc --- cygwin.sc 23 Jun 2002 18:55:23 -0000 1.7 +++ cygwin.sc 3 Sep 2002 06:25:51 -0000 @@ -40,4 +40,7 @@ SECTIONS *(SORT(.rdata$*)) *(.eh_frame) + ___RUNTIME_PSEUDO_RELOC_LIST__ = .; __RUNTIME_PSEUDO_RELOC_LIST__ = . ; + *(.rdata_runtime_pseudo_reloc) + ___RUNTIME_PSEUDO_RELOC_LIST_END__ = .; __RUNTIME_PSEUDO_RELOC_LIST_END__ = . ; } .pdata BLOCK(__section_alignment__) : Index: dcrt0.cc =================================================================== RCS file: /cvs/uberbaum/winsup/cygwin/dcrt0.cc,v retrieving revision 1.147 diff -u -p -2 -r1.147 dcrt0.cc --- dcrt0.cc 27 Aug 2002 04:10:54 -0000 1.147 +++ dcrt0.cc 3 Sep 2002 06:25:51 -0000 @@ -120,4 +120,25 @@ char *old_title; char title_buf[TITLESIZE + 1]; +typedef struct + { + DWORD addend; + DWORD target; + } +runtime_pseudo_reloc; + +extern "C" void _pei386_runtime_relocator (void*, void*, void*); + +void +_pei386_runtime_relocator (void* start, void* end, void* base) +{ + DWORD reloc_target; + runtime_pseudo_reloc* r; + for (r = (runtime_pseudo_reloc*) start; r < (runtime_pseudo_reloc*) end; r++) + { + reloc_target = (DWORD) base + r->target; + *((DWORD*) reloc_target) += r->addend; + } +} + static void do_global_dtors (void) @@ -537,4 +558,8 @@ sigthread::init (const char *s) } +extern char __RUNTIME_PSEUDO_RELOC_LIST__; +extern char __RUNTIME_PSEUDO_RELOC_LIST_END__; +extern char _image_base__; + /* Take over from libc's crt0.o and start the application. Note the various special cases when Cygwin DLL is being runtime loaded (as @@ -555,4 +580,8 @@ dll_crt0_1 () wincap.init (); check_sanity_and_sync (user_data); + + _pei386_runtime_relocator (&__RUNTIME_PSEUDO_RELOC_LIST__, + &__RUNTIME_PSEUDO_RELOC_LIST_END__, + &_image_base__); do_global_ctors (&__CTOR_LIST__, 1); Index: include/cygwin/version.h =================================================================== RCS file: /cvs/uberbaum/winsup/cygwin/include/cygwin/version.h,v retrieving revision 1.75 diff -u -p -2 -r1.75 version.h --- include/cygwin/version.h 30 Aug 2002 12:18:56 -0000 1.75 +++ include/cygwin/version.h 3 Sep 2002 06:25:52 -0000 @@ -165,4 +165,5 @@ details. */ wcsncmp, wcsncpy, wcspbrk, wcsrchr, wcsspn, wcsstr, wmemchr, wmemcmp, wmemcpy, wmemmove, wmemset + 63: Export _pei386_runtime_relocator. */ @@ -170,5 +171,5 @@ details. */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 62 +#define CYGWIN_VERSION_API_MINOR 63 /* There is also a compatibity version number associated with the Index: lib/crt0.h =================================================================== RCS file: /cvs/uberbaum/winsup/cygwin/lib/crt0.h,v retrieving revision 1.3 diff -u -p -2 -r1.3 crt0.h --- lib/crt0.h 11 Sep 2001 20:01:02 -0000 1.3 +++ lib/crt0.h 3 Sep 2002 06:25:52 -0000 @@ -13,4 +13,6 @@ extern "C" { #endif +void _pei386_runtime_relocator (void*, void*, void *); + struct per_process; typedef int (*MainFunc) (int argc, char *argv[], char **env);