summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libstdc++-v3/ChangeLog19
-rw-r--r--libstdc++-v3/config/os/bsd/darwin/os_defines.h6
-rw-r--r--libstdc++-v3/include/bits/c++config7
-rw-r--r--libstdc++-v3/libsupc++/del_op.cc2
-rw-r--r--libstdc++-v3/libsupc++/del_opnt.cc2
-rw-r--r--libstdc++-v3/libsupc++/del_opv.cc2
-rw-r--r--libstdc++-v3/libsupc++/del_opvnt.cc2
-rw-r--r--libstdc++-v3/libsupc++/new_op.cc2
-rw-r--r--libstdc++-v3/libsupc++/new_opnt.cc2
-rw-r--r--libstdc++-v3/libsupc++/new_opv.cc2
-rw-r--r--libstdc++-v3/libsupc++/new_opvnt.cc2
11 files changed, 40 insertions, 8 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 9063603c0a2..cb3ab699f21 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,22 @@
+2004-11-03 Aaron W. LaFramboise <aaronavay62@aaronwl.com>
+
+ * config/os/bsd/darwin/os_defines.h
+ (_GLIBCXX_WEAK_DEFINITION): Define.
+ * include/bits/c++config (_GLIBCXX_WEAK_DEFINITION): Define.
+ * libsupc++/del_op.cc (operator delete(void *)): Use
+ _GLIBCXX_WEAK_DEFINITION.
+ * libsupc++/del_opnt.cc
+ (operator delete(void *, const std::nothrow_t&)): Same.
+ * libsupc++/del_opv.cc (operator delete[](void *)): Same.
+ * libsupc++/del_opvnt.cc
+ (operator delete[](void *, const std::nothrow_t&)): Same.
+ * libsupc++/new_op.cc (operator new(std::size_t)): Same.
+ * libsupc++/new_opnt.cc
+ (operator new(std::size_t, const std::nothrow_t&)): Same
+ * libsupc++/new_opv.cc (operator new[](std::size_t)): Same.
+ * libsupc++/new_opvnt.cc
+ (operator new[](std::size_t, const std::nothrow_t&)): Same.
+
2004-11-02 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.tcc (num_get<>::_M_extract_int):
diff --git a/libstdc++-v3/config/os/bsd/darwin/os_defines.h b/libstdc++-v3/config/os/bsd/darwin/os_defines.h
index 9b68110d46a..07fb55b6125 100644
--- a/libstdc++-v3/config/os/bsd/darwin/os_defines.h
+++ b/libstdc++-v3/config/os/bsd/darwin/os_defines.h
@@ -38,4 +38,10 @@
links to, so there's no need for weak-ness for that. */
#define _GLIBCXX_GTHREAD_USE_WEAK 0
+// On Darwin, in order to enable overriding of operator new and delete,
+// GCC makes the definition of these functions weak, relies on the
+// loader to implement weak semantics properly, and uses
+// -flat_namespace to work around the way that it doesn't.
+#define _GLIBCXX_WEAK_DEFINITION __attribute__ ((weak))
+
#endif
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index 0c7b44c6217..064280b6756 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -51,6 +51,13 @@
# define _GLIBCXX_EXTERN_TEMPLATE 1
#endif
+// Certain function definitions that are meant to be overridable
+// from user code are decorated with this macro. For some targets,
+// this macro causes these definitions to be weak.
+#ifndef _GLIBCXX_WEAK_DEFINITION
+#define _GLIBCXX_WEAK_DEFINITION
+#endif
+
// Debug mode support. Debug mode basic_string is not allowed to be
// associated with std, because of locale and exception link
// dependence.
diff --git a/libstdc++-v3/libsupc++/del_op.cc b/libstdc++-v3/libsupc++/del_op.cc
index 32ccdb6808b..388f50863b1 100644
--- a/libstdc++-v3/libsupc++/del_op.cc
+++ b/libstdc++-v3/libsupc++/del_op.cc
@@ -39,7 +39,7 @@ using std::free;
extern "C" void free(void *);
#endif
-__attribute__((weak)) void
+_GLIBCXX_WEAK_DEFINITION void
operator delete (void *ptr) throw ()
{
if (ptr)
diff --git a/libstdc++-v3/libsupc++/del_opnt.cc b/libstdc++-v3/libsupc++/del_opnt.cc
index 6cfb0775e4f..76b7d69e002 100644
--- a/libstdc++-v3/libsupc++/del_opnt.cc
+++ b/libstdc++-v3/libsupc++/del_opnt.cc
@@ -32,7 +32,7 @@
extern "C" void free (void *);
-__attribute__((weak)) void
+_GLIBCXX_WEAK_DEFINITION void
operator delete (void *ptr, const std::nothrow_t&) throw ()
{
if (ptr)
diff --git a/libstdc++-v3/libsupc++/del_opv.cc b/libstdc++-v3/libsupc++/del_opv.cc
index 03e1612c47f..94cdfde32ca 100644
--- a/libstdc++-v3/libsupc++/del_opv.cc
+++ b/libstdc++-v3/libsupc++/del_opv.cc
@@ -30,7 +30,7 @@
#include "new"
-__attribute__((weak)) void
+_GLIBCXX_WEAK_DEFINITION void
operator delete[] (void *ptr) throw ()
{
::operator delete (ptr);
diff --git a/libstdc++-v3/libsupc++/del_opvnt.cc b/libstdc++-v3/libsupc++/del_opvnt.cc
index 5b55cda66e6..180b08f63d4 100644
--- a/libstdc++-v3/libsupc++/del_opvnt.cc
+++ b/libstdc++-v3/libsupc++/del_opvnt.cc
@@ -30,7 +30,7 @@
#include "new"
-__attribute__((weak)) void
+_GLIBCXX_WEAK_DEFINITION void
operator delete[] (void *ptr, const std::nothrow_t&) throw ()
{
::operator delete (ptr);
diff --git a/libstdc++-v3/libsupc++/new_op.cc b/libstdc++-v3/libsupc++/new_op.cc
index 656b9f42d55..0ebec1cd36f 100644
--- a/libstdc++-v3/libsupc++/new_op.cc
+++ b/libstdc++-v3/libsupc++/new_op.cc
@@ -43,7 +43,7 @@ extern "C" void *malloc (std::size_t);
extern new_handler __new_handler;
-__attribute__((weak)) void *
+_GLIBCXX_WEAK_DEFINITION void *
operator new (std::size_t sz) throw (std::bad_alloc)
{
void *p;
diff --git a/libstdc++-v3/libsupc++/new_opnt.cc b/libstdc++-v3/libsupc++/new_opnt.cc
index ff550b706ab..1b29c1a5f12 100644
--- a/libstdc++-v3/libsupc++/new_opnt.cc
+++ b/libstdc++-v3/libsupc++/new_opnt.cc
@@ -36,7 +36,7 @@ using std::bad_alloc;
extern "C" void *malloc (std::size_t);
extern new_handler __new_handler;
-__attribute__((weak)) void *
+_GLIBCXX_WEAK_DEFINITION void *
operator new (std::size_t sz, const std::nothrow_t&) throw()
{
void *p;
diff --git a/libstdc++-v3/libsupc++/new_opv.cc b/libstdc++-v3/libsupc++/new_opv.cc
index de3bc4ebd7c..9fa7d19ecc4 100644
--- a/libstdc++-v3/libsupc++/new_opv.cc
+++ b/libstdc++-v3/libsupc++/new_opv.cc
@@ -30,7 +30,7 @@
#include "new"
-__attribute__((weak)) void *
+_GLIBCXX_WEAK_DEFINITION void *
operator new[] (std::size_t sz) throw (std::bad_alloc)
{
return ::operator new(sz);
diff --git a/libstdc++-v3/libsupc++/new_opvnt.cc b/libstdc++-v3/libsupc++/new_opvnt.cc
index 1dbf991d838..79b8cdc1077 100644
--- a/libstdc++-v3/libsupc++/new_opvnt.cc
+++ b/libstdc++-v3/libsupc++/new_opvnt.cc
@@ -30,7 +30,7 @@
#include "new"
-__attribute__((weak)) void *
+_GLIBCXX_WEAK_DEFINITION void *
operator new[] (std::size_t sz, const std::nothrow_t& nothrow) throw()
{
return ::operator new(sz, nothrow);