This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [stdc++] Mark global new/delete operators as weak symbols
- From: Romain Geissler <romain dot geissler at gmail dot com>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, libstdc++ at gcc dot gnu dot org
- Cc: Lénaïc Huard <lenaic dot huard at laposte dot net>
- Date: Wed, 4 Sep 2013 16:30:30 +0200
- Subject: Re: [stdc++] Mark global new/delete operators as weak symbols
- Authentication-results: sourceware.org; auth=none
- References: <CAF+LTecSK4DJNZ7BsV_i45GEfRo=JoxkLapiZYZLBAqOxnw33w at mail dot gmail dot com>
Ping
2013/8/20 Romain Geissler <romain.geissler@gmail.com>:
> Hi,
>
> According to the C++ standard §17.4.3.4(2,3) the global new and delete
> operator implementation can be replaced by the program. For example,
> tcmalloc does redefine them. On ELF targets, it is currently OK if you
> link libstc++ dynamically. However, if you try to link both tcmalloc
> and stdc++ statically, then the linker will complain about multiple
> symbol definition.
>
> This patch fixes this by marking the global new/delete operator as
> weaks for linux. I may be extended to all ELF targets. Bootstrapped
> and tested on SLES 11 SP1 x86_64.
>
> Cheers,
> Romain
>
> /libstc++-v3/
>
> 2013-08-20 Romain Geissler <romain.geissler@gmail.com>
>
> * config/os/gnu-linux/os_defines.h: (_GLIBCXX_WEAK_DEFINITION): Define.