diff options
Diffstat (limited to 'winsup/cygwin/lib/_cygwin_crt0_common.cc')
-rw-r--r-- | winsup/cygwin/lib/_cygwin_crt0_common.cc | 51 |
1 files changed, 42 insertions, 9 deletions
diff --git a/winsup/cygwin/lib/_cygwin_crt0_common.cc b/winsup/cygwin/lib/_cygwin_crt0_common.cc index 83cbda828..b22859ec0 100644 --- a/winsup/cygwin/lib/_cygwin_crt0_common.cc +++ b/winsup/cygwin/lib/_cygwin_crt0_common.cc @@ -1,6 +1,7 @@ /* _cygwin_crt0_common.cc: common crt0 function for cygwin crt0's. - Copyright 2000, 2001, 2002, 2003, 2004, 2009, 2010, 2011, 2012 Red Hat, Inc. + Copyright 2000, 2001, 2002, 2003, 2004, 2009, 2010, 2011, 2012, 2013 + Red Hat, Inc. This file is part of Cygwin. @@ -16,26 +17,42 @@ details. */ unnecessarily. */ #define WEAK __attribute__ ((weak)) +#ifdef __x86_64__ +#define REAL_ZNWX "__real__Znwm" +#define REAL_ZNAX "__real__Znam" +#define REAL_ZNWX_NOTHROW_T "__real__ZnwmRKSt9nothrow_t" +#define REAL_ZNAX_NOTHROW_T "__real__ZnamRKSt9nothrow_t" +#else +#define REAL_ZNWX "___real__Znwj" +#define REAL_ZNAX "___real__Znaj" +#define REAL_ZNWX_NOTHROW_T "___real__ZnwjRKSt9nothrow_t" +#define REAL_ZNAX_NOTHROW_T "___real__ZnajRKSt9nothrow_t" +#endif +#define REAL_ZDLPV _SYMSTR (__real__ZdlPv) +#define REAL_ZDAPV _SYMSTR (__real__ZdaPv) +#define REAL_ZDLPV_NOTHROW_T _SYMSTR (__real__ZdlPvRKSt9nothrow_t) +#define REAL_ZDAPV_NOTHROW_T _SYMSTR (__real__ZdaPvRKSt9nothrow_t) + /* Use asm names to bypass the --wrap that is being applied to redirect all other references to these operators toward the redirectors in the Cygwin DLL; this way we can record what definitions were visible at final link time but still send all calls to the redirectors. */ extern WEAK void *operator new(std::size_t sz) throw (std::bad_alloc) - __asm__ ("___real__Znwj"); + __asm__ (REAL_ZNWX); extern WEAK void *operator new[](std::size_t sz) throw (std::bad_alloc) - __asm__ ("___real__Znaj"); + __asm__ (REAL_ZNAX); extern WEAK void operator delete(void *p) throw() - __asm__ ("___real__ZdlPv "); + __asm__ (REAL_ZDLPV); extern WEAK void operator delete[](void *p) throw() - __asm__ ("___real__ZdaPv"); + __asm__ (REAL_ZDAPV); extern WEAK void *operator new(std::size_t sz, const std::nothrow_t &nt) throw() - __asm__ ("___real__ZnwjRKSt9nothrow_t"); + __asm__ (REAL_ZNWX_NOTHROW_T); extern WEAK void *operator new[](std::size_t sz, const std::nothrow_t &nt) throw() - __asm__ ("___real__ZnajRKSt9nothrow_t"); + __asm__ (REAL_ZNAX_NOTHROW_T); extern WEAK void operator delete(void *p, const std::nothrow_t &nt) throw() - __asm__ ("___real__ZdlPvRKSt9nothrow_t"); + __asm__ (REAL_ZDLPV_NOTHROW_T); extern WEAK void operator delete[](void *p, const std::nothrow_t &nt) throw() - __asm__ ("___real__ZdaPvRKSt9nothrow_t"); + __asm__ (REAL_ZDAPV_NOTHROW_T); /* Avoid an info message from linker when linking applications. */ extern __declspec(dllimport) struct _reent *_impure_ptr; @@ -47,12 +64,19 @@ extern int __dynamically_loaded; extern "C" { +#ifndef __x86_64__ char **environ; +#endif int _fmode; extern char __RUNTIME_PSEUDO_RELOC_LIST__; extern char __RUNTIME_PSEUDO_RELOC_LIST_END__; +#ifdef __x86_64__ +extern char __image_base__; +#define _image_base__ __image_base__ +#else extern char _image_base__; +#endif struct per_process_cxx_malloc __cygwin_cxx_malloc = { @@ -93,7 +117,9 @@ _cygwin_crt0_common (MainFunc f, per_process *u) u->ctors = &__CTOR_LIST__; u->dtors = &__DTOR_LIST__; +#ifndef __x86_64__ u->envptr = &environ; +#endif if (uwasnull) _impure_ptr = u->impure_ptr; /* Use field initialized in newer DLLs. */ else @@ -145,10 +171,17 @@ _cygwin_crt0_common (MainFunc f, per_process *u) u->hmodule = GetModuleHandle (0); /* variables for fork */ +#ifdef __x86_64__ + u->data_start = &__data_start__; + u->data_end = &__data_end__; + u->bss_start = &__bss_start__; + u->bss_end = &__bss_end__; +#else u->data_start = &_data_start__; u->data_end = &_data_end__; u->bss_start = &_bss_start__; u->bss_end = &_bss_end__; +#endif u->pseudo_reloc_start = &__RUNTIME_PSEUDO_RELOC_LIST__; u->pseudo_reloc_end = &__RUNTIME_PSEUDO_RELOC_LIST_END__; u->image_base = &_image_base__; |