winsup/ChangeLog:
* Makefile.common (COMPILE_CXX): Add support for per-file overrides
to exclude $(nostdinc) and $(nostdincxx) from compiler flags.
(COMPILE_CC): Likewise for $(nostdinc).
winsup/cygwin/ChangeLog:
* Makefile.in (DLL_OFILES): Add libstdcxx_wrapper.o
(libstdcxx_wrapper_CFLAGS): Add flags for new module.
(_cygwin_crt0_common_STDINCFLAGS): Define per-file override.
(libstdcxx_wrapper_STDINCFLAGS, cxx_STDINCFLAGS): Likewise.
* cxx.cc: Include "cygwin-cxx.h".
(operator new): Tweak prototype for full standards compliance.
(operator new[]): Likewise.
(operator new (nothrow)): New fallback function.
(operator new[] (nothrow), operator delete (nothrow),
operator delete[] (nothrow)): Likewise.
(default_cygwin_cxx_malloc): New struct of pointers to the above,
for final last-resort fallback default.
* cygwin-cxx.h: New file.
(struct per_process_cxx_malloc): Define.
(default_cygwin_cxx_malloc): Declare extern.
* cygwin.din (__wrap__ZdaPv): Export new wrapper.
(__wrap__ZdaPvRKSt9nothrow_t, __wrap__ZdlPv,
__wrap__ZdlPvRKSt9nothrow_t, __wrap__Znaj,
__wrap__ZnajRKSt9nothrow_t, __wrap__Znwj,
__wrap__ZnwjRKSt9nothrow_t): Likewise.
* globals.cc (__cygwin_user_data): Init newly-repurposed 'forkee'
field (now 'cxx_malloc') to point to default_cygwin_cxx_malloc.
* libstdcxx_wrapper.cc: New file.
(__wrap__ZdaPv, __wrap__ZdaPvRKSt9nothrow_t, __wrap__ZdlPv,
__wrap__ZdlPvRKSt9nothrow_t, __wrap__Znaj,
__wrap__ZnajRKSt9nothrow_t, __wrap__Znwj,
__wrap__ZnwjRKSt9nothrow_t): Define wrapper functions for libstdc++
malloc operators and their overrides.
* winsup.h (default_cygwin_cxx_malloc): Declare extern.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
* include/sys/cygwin.h (struct per_process_cxx_malloc): Forward
declare here.
(struct per_process::forkee): Rename and repurpose from this ...
(struct per_process::cxx_malloc): ... to this.
* lib/_cygwin_crt0_common.cc: Include cygwin-cxx.h.
(WEAK): Define shorthand helper macro.
(__cygwin_cxx_malloc): Define and populate with weak references
to whatever libstdc++ malloc operators will be visible at final
link time for Cygwin apps and dlls.
(_cygwin_crt0_common): Always look up cygwin DLL's internal
per_process data, and don't test for (impossible) failure. Inherit
any members of __cygwin_cxx_malloc that we don't have overrides
for from the DLL's default and store the resulting overall set of
overrides back into the DLL's global per_process data.
2009-07-08 04:12:44 +08:00
|
|
|
/* libstdcxx_wrapper.cc
|
|
|
|
|
|
|
|
Copyright 2009 Red Hat, Inc.
|
|
|
|
|
|
|
|
This file is part of Cygwin.
|
|
|
|
|
|
|
|
This software is a copyrighted work licensed under the terms of the
|
|
|
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|
|
|
details. */
|
|
|
|
|
|
|
|
|
|
|
|
/* We provide these stubs to call into a user's
|
|
|
|
provided ONDEE replacement if there is one - otherwise
|
|
|
|
it must fall back to the standard libstdc++ version. */
|
|
|
|
|
|
|
|
#include "winsup.h"
|
|
|
|
#include "cygwin-cxx.h"
|
|
|
|
#include "perprocess.h"
|
|
|
|
|
|
|
|
/* We are declaring asm names for the functions we define here, as we want
|
|
|
|
to define the wrappers in this file. GCC links everything with wrappers
|
|
|
|
around the standard C++ memory management operators; these are the wrappers,
|
|
|
|
but we want the compiler to know they are the malloc operators and not have
|
|
|
|
it think they're just any old function matching 'extern "C" _wrap_*'. */
|
|
|
|
|
|
|
|
extern void *operator new(std::size_t sz) throw (std::bad_alloc)
|
|
|
|
__asm__ ("___wrap__Znwj");
|
|
|
|
extern void *operator new[](std::size_t sz) throw (std::bad_alloc)
|
|
|
|
__asm__ ("___wrap__Znaj");
|
|
|
|
extern void operator delete(void *p) throw()
|
2009-07-18 07:37:05 +08:00
|
|
|
__asm__ ("___wrap__ZdlPv");
|
winsup/ChangeLog:
* Makefile.common (COMPILE_CXX): Add support for per-file overrides
to exclude $(nostdinc) and $(nostdincxx) from compiler flags.
(COMPILE_CC): Likewise for $(nostdinc).
winsup/cygwin/ChangeLog:
* Makefile.in (DLL_OFILES): Add libstdcxx_wrapper.o
(libstdcxx_wrapper_CFLAGS): Add flags for new module.
(_cygwin_crt0_common_STDINCFLAGS): Define per-file override.
(libstdcxx_wrapper_STDINCFLAGS, cxx_STDINCFLAGS): Likewise.
* cxx.cc: Include "cygwin-cxx.h".
(operator new): Tweak prototype for full standards compliance.
(operator new[]): Likewise.
(operator new (nothrow)): New fallback function.
(operator new[] (nothrow), operator delete (nothrow),
operator delete[] (nothrow)): Likewise.
(default_cygwin_cxx_malloc): New struct of pointers to the above,
for final last-resort fallback default.
* cygwin-cxx.h: New file.
(struct per_process_cxx_malloc): Define.
(default_cygwin_cxx_malloc): Declare extern.
* cygwin.din (__wrap__ZdaPv): Export new wrapper.
(__wrap__ZdaPvRKSt9nothrow_t, __wrap__ZdlPv,
__wrap__ZdlPvRKSt9nothrow_t, __wrap__Znaj,
__wrap__ZnajRKSt9nothrow_t, __wrap__Znwj,
__wrap__ZnwjRKSt9nothrow_t): Likewise.
* globals.cc (__cygwin_user_data): Init newly-repurposed 'forkee'
field (now 'cxx_malloc') to point to default_cygwin_cxx_malloc.
* libstdcxx_wrapper.cc: New file.
(__wrap__ZdaPv, __wrap__ZdaPvRKSt9nothrow_t, __wrap__ZdlPv,
__wrap__ZdlPvRKSt9nothrow_t, __wrap__Znaj,
__wrap__ZnajRKSt9nothrow_t, __wrap__Znwj,
__wrap__ZnwjRKSt9nothrow_t): Define wrapper functions for libstdc++
malloc operators and their overrides.
* winsup.h (default_cygwin_cxx_malloc): Declare extern.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
* include/sys/cygwin.h (struct per_process_cxx_malloc): Forward
declare here.
(struct per_process::forkee): Rename and repurpose from this ...
(struct per_process::cxx_malloc): ... to this.
* lib/_cygwin_crt0_common.cc: Include cygwin-cxx.h.
(WEAK): Define shorthand helper macro.
(__cygwin_cxx_malloc): Define and populate with weak references
to whatever libstdc++ malloc operators will be visible at final
link time for Cygwin apps and dlls.
(_cygwin_crt0_common): Always look up cygwin DLL's internal
per_process data, and don't test for (impossible) failure. Inherit
any members of __cygwin_cxx_malloc that we don't have overrides
for from the DLL's default and store the resulting overall set of
overrides back into the DLL's global per_process data.
2009-07-08 04:12:44 +08:00
|
|
|
extern void operator delete[](void *p) throw()
|
|
|
|
__asm__ ("___wrap__ZdaPv");
|
|
|
|
extern void *operator new(std::size_t sz, const std::nothrow_t &nt) throw()
|
|
|
|
__asm__ ("___wrap__ZnwjRKSt9nothrow_t");
|
|
|
|
extern void *operator new[](std::size_t sz, const std::nothrow_t &nt) throw()
|
|
|
|
__asm__ ("___wrap__ZnajRKSt9nothrow_t");
|
|
|
|
extern void operator delete(void *p, const std::nothrow_t &nt) throw()
|
|
|
|
__asm__ ("___wrap__ZdlPvRKSt9nothrow_t");
|
|
|
|
extern void operator delete[](void *p, const std::nothrow_t &nt) throw()
|
|
|
|
__asm__ ("___wrap__ZdaPvRKSt9nothrow_t");
|
|
|
|
|
|
|
|
extern void *
|
|
|
|
operator new(std::size_t sz) throw (std::bad_alloc)
|
|
|
|
{
|
|
|
|
return (*user_data->cxx_malloc->oper_new) (sz);
|
|
|
|
}
|
|
|
|
|
|
|
|
extern void *
|
|
|
|
operator new[](std::size_t sz) throw (std::bad_alloc)
|
|
|
|
{
|
|
|
|
return (*user_data->cxx_malloc->oper_new__) (sz);
|
|
|
|
}
|
|
|
|
|
|
|
|
extern void
|
|
|
|
operator delete(void *p) throw()
|
|
|
|
{
|
|
|
|
(*user_data->cxx_malloc->oper_delete) (p);
|
|
|
|
}
|
|
|
|
|
|
|
|
extern void
|
|
|
|
operator delete[](void *p) throw()
|
|
|
|
{
|
|
|
|
(*user_data->cxx_malloc->oper_delete__) (p);
|
|
|
|
}
|
|
|
|
|
|
|
|
extern void *
|
|
|
|
operator new(std::size_t sz, const std::nothrow_t &nt) throw()
|
|
|
|
{
|
|
|
|
return (*user_data->cxx_malloc->oper_new_nt) (sz, nt);
|
|
|
|
}
|
|
|
|
|
|
|
|
extern void *
|
|
|
|
operator new[](std::size_t sz, const std::nothrow_t &nt) throw()
|
|
|
|
{
|
|
|
|
return (*user_data->cxx_malloc->oper_new___nt) (sz, nt);
|
|
|
|
}
|
|
|
|
|
|
|
|
extern void
|
|
|
|
operator delete(void *p, const std::nothrow_t &nt) throw()
|
|
|
|
{
|
|
|
|
(*user_data->cxx_malloc->oper_delete_nt) (p, nt);
|
|
|
|
}
|
|
|
|
|
|
|
|
extern void
|
|
|
|
operator delete[](void *p, const std::nothrow_t &nt) throw()
|
|
|
|
{
|
|
|
|
(*user_data->cxx_malloc->oper_delete___nt) (p, nt);
|
|
|
|
}
|
|
|
|
|