This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[stdc++] Mark global new/delete operators as weak symbols


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.

Attachment: 0001-Define-global-new-delete-operators-as-weak-symbols.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]