Thanks for the comments Paolo. I have attached the new patch. I have bumped the version to 3.4.18 and used _ZdlPv[jmy] in gnu.ver. I have also added the symbol to baseline_symbols.txt of other targets.
-Easwaran ------------ 2011-12-11 Easwaran Raman <era...@google.com> * common.opt (fsized-delete): New option. cp/ChangeLog.google-4_6: 2011-12-11 Easwaran Raman <era...@google.com> * decl.c (cxx_init_decl_processing): Specify a function that takes a void* and size_t for DELETE_EXPR. * call.c (build_op_delete_call): If fsized-delete is used, use the variant that takes size_t as the second parameter except when deleteting a pointer of type void *. testsuite/ChangeLog.google-4_6: 2011-12-11 Easwaran Raman <era...@google.com> * g++.dg/other/sized-delete-1.C: New test. libstdc++-v3/ChangeLog.google-4_6: 2011-12-11 Easwaran Raman <era...@google.com> * libsupc++/del_op.cc (delete): Define a new variant void operator delete(void*, std::size_t). * libsupc++/new (delete): Declare void operator delete(void*, std::size_t) throw(); * testsuite/util/testsuite_abi.cc (check_version): Add new known version GLIBCXX_3.4.18. * config/abi/post/i386-linux-gnu/baseline_symbols.txt: Add new symbol _ZdlPvm@@GLIBCXX_3.4.18. * config/abi/post/sparc-linux-gnu/baseline_symbols.txt: Likewise. * config/abi/post/mips64-linux-gnu/64/baseline_symbols.txt: Likewise. * config/abi/post/mips64-linux-gnu/baseline_symbols.txt: Likewise. * config/abi/post/alpha-linux-gnu/baseline_symbols.txt: Likewise. * config/abi/post/i486-linux-gnu/baseline_symbols.txt: Likewise. * config/abi/post/s390-linux-gnu/baseline_symbols.txt: Likewise. * config/abi/post/powerpc64-linux-gnu/32/baseline_symbols.txt: Likewise. * config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt: Likewise. * config/abi/post/mips-linux-gnu/baseline_symbols.txt: Likewise. * config/abi/post/x86_64-linux-gnu/32/baseline_symbols.txt: Likewise. * config/abi/post/x86_64-linux-gnu/baseline_symbols.txt: Likewise. * config/abi/post/x86_64-linux-gnu/x32/baseline_symbols.txt: Likewise. * config/abi/post/ia64-linux-gnu/baseline_symbols.txt: Likewise. * config/abi/post/solaris2.10/amd64/baseline_symbols.txt: Likewise. * config/abi/post/solaris2.10/sparcv9/baseline_symbols.txt: Likewise. * config/abi/post/solaris2.10/baseline_symbols.txt: Likewise. * config/abi/post/powerpc-linux-gnu/baseline_symbols.txt: Likewise. * config/abi/post/hppa-linux-gnu/baseline_symbols.txt: Likewise. * config/abi/post/s390x-linux-gnu/baseline_symbols.txt: Likewise. * config/abi/post/solaris2.8/sparcv9/baseline_symbols.txt: Likewise. * config/abi/post/solaris2.8/baseline_symbols.txt: Likewise. * config/abi/pre/gnu.ver: Add new symbol _ZdlPv[jmy] at version GLIBCXX_3.4.18. On Mon, Dec 12, 2011 at 5:25 AM, Paolo Carlini <paolo.carl...@oracle.com> wrote: > On 12/12/2011 02:21 PM, Diego Novillo wrote: >> >> Ah, right. I missed the ABI implications. > > For possible inclusion in mainline too, things don't seem completely ok: > nothing should be added to the baseline and very likely the export should be > adjusted to accommodate for different size_t on the various targets, by > using [] in the pattern. See, eg, the existing operator new[](size_t). > > Paolo.
Index: libstdc++-v3/libsupc++/del_op.cc =================================================================== --- libstdc++-v3/libsupc++/del_op.cc (revision 182251) +++ libstdc++-v3/libsupc++/del_op.cc (working copy) @@ -46,3 +46,11 @@ operator delete(void* ptr) throw () if (ptr) std::free(ptr); } + +_GLIBCXX_WEAK_DEFINITION void +operator delete(void* ptr, + std::size_t bytes __attribute__((__unused__))) throw () +{ + if (ptr) + std::free(ptr); +} Index: libstdc++-v3/libsupc++/new =================================================================== --- libstdc++-v3/libsupc++/new (revision 182251) +++ libstdc++-v3/libsupc++/new (working copy) @@ -93,6 +93,7 @@ namespace std void* operator new(std::size_t) throw (std::bad_alloc); void* operator new[](std::size_t) throw (std::bad_alloc); void operator delete(void*) throw(); +void operator delete(void*, std::size_t) throw(); void operator delete[](void*) throw(); void* operator new(std::size_t, const std::nothrow_t&) throw(); void* operator new[](std::size_t, const std::nothrow_t&) throw(); Index: libstdc++-v3/testsuite/util/testsuite_abi.cc =================================================================== --- libstdc++-v3/testsuite/util/testsuite_abi.cc (revision 182251) +++ libstdc++-v3/testsuite/util/testsuite_abi.cc (working copy) @@ -195,6 +195,7 @@ check_version(symbol& test, bool added) known_versions.push_back("GLIBCXX_3.4.15"); known_versions.push_back("GLIBCXX_3.4.16"); known_versions.push_back("GLIBCXX_3.4.17"); + known_versions.push_back("GLIBCXX_3.4.18"); known_versions.push_back("GLIBCXX_LDBL_3.4"); known_versions.push_back("GLIBCXX_LDBL_3.4.7"); known_versions.push_back("GLIBCXX_LDBL_3.4.10"); @@ -561,4 +562,3 @@ demangle(const std::string& mangled) } return name; } - Index: libstdc++-v3/config/abi/post/x86_64-linux-gnu/32/baseline_symbols.txt =================================================================== --- libstdc++-v3/config/abi/post/x86_64-linux-gnu/32/baseline_symbols.txt (revision 182251) +++ libstdc++-v3/config/abi/post/x86_64-linux-gnu/32/baseline_symbols.txt (working copy) @@ -2422,6 +2422,7 @@ FUNC:_ZTv0_n12_NSt9strstreamD1Ev@@GLIBCXX_3.4 FUNC:_ZdaPv@@GLIBCXX_3.4 FUNC:_ZdaPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_ZdlPv@@GLIBCXX_3.4 +FUNC:_ZdlPvj@@GLIBCXX_3.4.18 FUNC:_ZdlPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_Znaj@@GLIBCXX_3.4 FUNC:_ZnajRKSt9nothrow_t@@GLIBCXX_3.4 Index: libstdc++-v3/config/abi/post/x86_64-linux-gnu/baseline_symbols.txt =================================================================== --- libstdc++-v3/config/abi/post/x86_64-linux-gnu/baseline_symbols.txt (revision 182251) +++ libstdc++-v3/config/abi/post/x86_64-linux-gnu/baseline_symbols.txt (working copy) @@ -2422,6 +2422,7 @@ FUNC:_ZTv0_n24_NSt9strstreamD1Ev@@GLIBCXX_3.4 FUNC:_ZdaPv@@GLIBCXX_3.4 FUNC:_ZdaPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_ZdlPv@@GLIBCXX_3.4 +FUNC:_ZdlPvm@@GLIBCXX_3.4.18 FUNC:_ZdlPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_Znam@@GLIBCXX_3.4 FUNC:_ZnamRKSt9nothrow_t@@GLIBCXX_3.4 Index: libstdc++-v3/config/abi/post/x86_64-linux-gnu/x32/baseline_symbols.txt =================================================================== --- libstdc++-v3/config/abi/post/x86_64-linux-gnu/x32/baseline_symbols.txt (revision 182251) +++ libstdc++-v3/config/abi/post/x86_64-linux-gnu/x32/baseline_symbols.txt (working copy) @@ -2424,6 +2424,7 @@ FUNC:_ZTv0_n12_NSt9strstreamD1Ev@@GLIBCXX_3.4 FUNC:_ZdaPv@@GLIBCXX_3.4 FUNC:_ZdaPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_ZdlPv@@GLIBCXX_3.4 +FUNC:_ZdlPvj@@GLIBCXX_3.4.18 FUNC:_ZdlPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_Znaj@@GLIBCXX_3.4 FUNC:_ZnajRKSt9nothrow_t@@GLIBCXX_3.4 Index: libstdc++-v3/config/abi/post/s390-linux-gnu/baseline_symbols.txt =================================================================== --- libstdc++-v3/config/abi/post/s390-linux-gnu/baseline_symbols.txt (revision 182251) +++ libstdc++-v3/config/abi/post/s390-linux-gnu/baseline_symbols.txt (working copy) @@ -2633,6 +2633,7 @@ FUNC:_ZTv0_n12_NSt9strstreamD1Ev@@GLIBCXX_3.4 FUNC:_ZdaPv@@GLIBCXX_3.4 FUNC:_ZdaPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_ZdlPv@@GLIBCXX_3.4 +FUNC:_ZdlPvm@@GLIBCXX_3.4.18 FUNC:_ZdlPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_Znam@@GLIBCXX_3.4 FUNC:_ZnamRKSt9nothrow_t@@GLIBCXX_3.4 Index: libstdc++-v3/config/abi/post/ia64-linux-gnu/baseline_symbols.txt =================================================================== --- libstdc++-v3/config/abi/post/ia64-linux-gnu/baseline_symbols.txt (revision 182251) +++ libstdc++-v3/config/abi/post/ia64-linux-gnu/baseline_symbols.txt (working copy) @@ -2302,6 +2302,7 @@ FUNC:_ZTv0_n24_NSt9strstreamD1Ev@@GLIBCXX_3.4 FUNC:_ZdaPv@@GLIBCXX_3.4 FUNC:_ZdaPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_ZdlPv@@GLIBCXX_3.4 +FUNC:_ZdlPvm@@GLIBCXX_3.4.18 FUNC:_ZdlPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_Znam@@GLIBCXX_3.4 FUNC:_ZnamRKSt9nothrow_t@@GLIBCXX_3.4 Index: libstdc++-v3/config/abi/post/sparc-linux-gnu/baseline_symbols.txt =================================================================== --- libstdc++-v3/config/abi/post/sparc-linux-gnu/baseline_symbols.txt (revision 182251) +++ libstdc++-v3/config/abi/post/sparc-linux-gnu/baseline_symbols.txt (working copy) @@ -2631,6 +2631,7 @@ FUNC:_ZTv0_n12_NSt19basic_ostringstreamIwSt11char_ FUNC:_ZTv0_n12_NSt9strstreamD0Ev@@GLIBCXX_3.4 FUNC:_ZTv0_n12_NSt9strstreamD1Ev@@GLIBCXX_3.4 FUNC:_ZdaPv@@GLIBCXX_3.4 +FUNC:_ZdlPvj@@GLIBCXX_3.4.18 FUNC:_ZdaPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_ZdlPv@@GLIBCXX_3.4 FUNC:_ZdlPvRKSt9nothrow_t@@GLIBCXX_3.4 Index: libstdc++-v3/config/abi/post/mips-linux-gnu/baseline_symbols.txt =================================================================== --- libstdc++-v3/config/abi/post/mips-linux-gnu/baseline_symbols.txt (revision 182251) +++ libstdc++-v3/config/abi/post/mips-linux-gnu/baseline_symbols.txt (working copy) @@ -2238,6 +2238,7 @@ FUNC:_ZTv0_n12_NSt9strstreamD1Ev@@GLIBCXX_3.4 FUNC:_ZdaPv@@GLIBCXX_3.4 FUNC:_ZdaPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_ZdlPv@@GLIBCXX_3.4 +FUNC:_ZdlPvj@@GLIBCXX_3.4.18 FUNC:_ZdlPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_Znaj@@GLIBCXX_3.4 FUNC:_ZnajRKSt9nothrow_t@@GLIBCXX_3.4 Index: libstdc++-v3/config/abi/post/powerpc-linux-gnu/baseline_symbols.txt =================================================================== --- libstdc++-v3/config/abi/post/powerpc-linux-gnu/baseline_symbols.txt (revision 182251) +++ libstdc++-v3/config/abi/post/powerpc-linux-gnu/baseline_symbols.txt (working copy) @@ -2633,6 +2633,7 @@ FUNC:_ZTv0_n12_NSt9strstreamD1Ev@@GLIBCXX_3.4 FUNC:_ZdaPv@@GLIBCXX_3.4 FUNC:_ZdaPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_ZdlPv@@GLIBCXX_3.4 +FUNC:_ZdlPvj@@GLIBCXX_3.4.18 FUNC:_ZdlPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_Znaj@@GLIBCXX_3.4 FUNC:_ZnajRKSt9nothrow_t@@GLIBCXX_3.4 Index: libstdc++-v3/config/abi/post/solaris2.8/sparcv9/baseline_symbols.txt =================================================================== --- libstdc++-v3/config/abi/post/solaris2.8/sparcv9/baseline_symbols.txt (revision 182251) +++ libstdc++-v3/config/abi/post/solaris2.8/sparcv9/baseline_symbols.txt (working copy) @@ -2362,6 +2362,7 @@ FUNC:_ZTv0_n24_NSt9strstreamD1Ev@@GLIBCXX_3.4 FUNC:_ZdaPv@@GLIBCXX_3.4 FUNC:_ZdaPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_ZdlPv@@GLIBCXX_3.4 +FUNC:_ZdlPvm@@GLIBCXX_3.4.18 FUNC:_ZdlPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_Znam@@GLIBCXX_3.4 FUNC:_ZnamRKSt9nothrow_t@@GLIBCXX_3.4 Index: libstdc++-v3/config/abi/post/solaris2.8/baseline_symbols.txt =================================================================== --- libstdc++-v3/config/abi/post/solaris2.8/baseline_symbols.txt (revision 182251) +++ libstdc++-v3/config/abi/post/solaris2.8/baseline_symbols.txt (working copy) @@ -2362,6 +2362,7 @@ FUNC:_ZTv0_n12_NSt9strstreamD1Ev@@GLIBCXX_3.4 FUNC:_ZdaPv@@GLIBCXX_3.4 FUNC:_ZdaPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_ZdlPv@@GLIBCXX_3.4 +FUNC:_ZdlPvj@@GLIBCXX_3.4.18 FUNC:_ZdlPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_Znaj@@GLIBCXX_3.4 FUNC:_ZnajRKSt9nothrow_t@@GLIBCXX_3.4 Index: libstdc++-v3/config/abi/post/mips64-linux-gnu/baseline_symbols.txt =================================================================== --- libstdc++-v3/config/abi/post/mips64-linux-gnu/baseline_symbols.txt (revision 182251) +++ libstdc++-v3/config/abi/post/mips64-linux-gnu/baseline_symbols.txt (working copy) @@ -2302,6 +2302,7 @@ FUNC:_ZTv0_n12_NSt9strstreamD1Ev@@GLIBCXX_3.4 FUNC:_ZdaPv@@GLIBCXX_3.4 FUNC:_ZdaPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_ZdlPv@@GLIBCXX_3.4 +FUNC:_ZdlPvj@@GLIBCXX_3.4.18 FUNC:_ZdlPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_Znaj@@GLIBCXX_3.4 FUNC:_ZnajRKSt9nothrow_t@@GLIBCXX_3.4 Index: libstdc++-v3/config/abi/post/mips64-linux-gnu/64/baseline_symbols.txt =================================================================== --- libstdc++-v3/config/abi/post/mips64-linux-gnu/64/baseline_symbols.txt (revision 182251) +++ libstdc++-v3/config/abi/post/mips64-linux-gnu/64/baseline_symbols.txt (working copy) @@ -2302,6 +2302,7 @@ FUNC:_ZTv0_n24_NSt9strstreamD1Ev@@GLIBCXX_3.4 FUNC:_ZdaPv@@GLIBCXX_3.4 FUNC:_ZdaPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_ZdlPv@@GLIBCXX_3.4 +FUNC:_ZdlPvm@@GLIBCXX_3.4.18 FUNC:_ZdlPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_Znam@@GLIBCXX_3.4 FUNC:_ZnamRKSt9nothrow_t@@GLIBCXX_3.4 Index: libstdc++-v3/config/abi/post/alpha-linux-gnu/baseline_symbols.txt =================================================================== --- libstdc++-v3/config/abi/post/alpha-linux-gnu/baseline_symbols.txt (revision 182251) +++ libstdc++-v3/config/abi/post/alpha-linux-gnu/baseline_symbols.txt (working copy) @@ -2633,6 +2633,7 @@ FUNC:_ZTv0_n24_NSt9strstreamD1Ev@@GLIBCXX_3.4 FUNC:_ZdaPv@@GLIBCXX_3.4 FUNC:_ZdaPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_ZdlPv@@GLIBCXX_3.4 +FUNC:_ZdlPvm@@GLIBCXX_3.4.18 FUNC:_ZdlPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_Znam@@GLIBCXX_3.4 FUNC:_ZnamRKSt9nothrow_t@@GLIBCXX_3.4 Index: libstdc++-v3/config/abi/post/s390x-linux-gnu/baseline_symbols.txt =================================================================== --- libstdc++-v3/config/abi/post/s390x-linux-gnu/baseline_symbols.txt (revision 182251) +++ libstdc++-v3/config/abi/post/s390x-linux-gnu/baseline_symbols.txt (working copy) @@ -2633,6 +2633,7 @@ FUNC:_ZTv0_n24_NSt9strstreamD1Ev@@GLIBCXX_3.4 FUNC:_ZdaPv@@GLIBCXX_3.4 FUNC:_ZdaPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_ZdlPv@@GLIBCXX_3.4 +FUNC:_ZdlPvm@@GLIBCXX_3.4.18 FUNC:_ZdlPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_Znam@@GLIBCXX_3.4 FUNC:_ZnamRKSt9nothrow_t@@GLIBCXX_3.4 Index: libstdc++-v3/config/abi/post/hppa-linux-gnu/baseline_symbols.txt =================================================================== --- libstdc++-v3/config/abi/post/hppa-linux-gnu/baseline_symbols.txt (revision 182251) +++ libstdc++-v3/config/abi/post/hppa-linux-gnu/baseline_symbols.txt (working copy) @@ -2238,6 +2238,7 @@ FUNC:_ZTv0_n12_NSt9strstreamD1Ev@@GLIBCXX_3.4 FUNC:_ZdaPv@@GLIBCXX_3.4 FUNC:_ZdaPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_ZdlPv@@GLIBCXX_3.4 +FUNC:_ZdlPvj@@GLIBCXX_3.4.18 FUNC:_ZdlPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_Znaj@@GLIBCXX_3.4 FUNC:_ZnajRKSt9nothrow_t@@GLIBCXX_3.4 Index: libstdc++-v3/config/abi/post/solaris2.10/sparcv9/baseline_symbols.txt =================================================================== --- libstdc++-v3/config/abi/post/solaris2.10/sparcv9/baseline_symbols.txt (revision 182251) +++ libstdc++-v3/config/abi/post/solaris2.10/sparcv9/baseline_symbols.txt (working copy) @@ -2385,6 +2385,7 @@ FUNC:_ZTv0_n24_NSt9strstreamD1Ev@@GLIBCXX_3.4 FUNC:_ZdaPv@@GLIBCXX_3.4 FUNC:_ZdaPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_ZdlPv@@GLIBCXX_3.4 +FUNC:_ZdlPvm@@GLIBCXX_3.4.18 FUNC:_ZdlPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_Znam@@GLIBCXX_3.4 FUNC:_ZnamRKSt9nothrow_t@@GLIBCXX_3.4 Index: libstdc++-v3/config/abi/post/solaris2.10/baseline_symbols.txt =================================================================== --- libstdc++-v3/config/abi/post/solaris2.10/baseline_symbols.txt (revision 182251) +++ libstdc++-v3/config/abi/post/solaris2.10/baseline_symbols.txt (working copy) @@ -2385,6 +2385,7 @@ FUNC:_ZTv0_n12_NSt9strstreamD1Ev@@GLIBCXX_3.4 FUNC:_ZdaPv@@GLIBCXX_3.4 FUNC:_ZdaPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_ZdlPv@@GLIBCXX_3.4 +FUNC:_ZdlPvj@@GLIBCXX_3.4.18 FUNC:_ZdlPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_Znaj@@GLIBCXX_3.4 FUNC:_ZnajRKSt9nothrow_t@@GLIBCXX_3.4 Index: libstdc++-v3/config/abi/post/solaris2.10/amd64/baseline_symbols.txt =================================================================== --- libstdc++-v3/config/abi/post/solaris2.10/amd64/baseline_symbols.txt (revision 182251) +++ libstdc++-v3/config/abi/post/solaris2.10/amd64/baseline_symbols.txt (working copy) @@ -2385,6 +2385,7 @@ FUNC:_ZTv0_n24_NSt9strstreamD1Ev@@GLIBCXX_3.4 FUNC:_ZdaPv@@GLIBCXX_3.4 FUNC:_ZdaPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_ZdlPv@@GLIBCXX_3.4 +FUNC:_ZdlPvm@@GLIBCXX_3.4.18 FUNC:_ZdlPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_Znam@@GLIBCXX_3.4 FUNC:_ZnamRKSt9nothrow_t@@GLIBCXX_3.4 Index: libstdc++-v3/config/abi/post/powerpc64-linux-gnu/32/baseline_symbols.txt =================================================================== --- libstdc++-v3/config/abi/post/powerpc64-linux-gnu/32/baseline_symbols.txt (revision 182251) +++ libstdc++-v3/config/abi/post/powerpc64-linux-gnu/32/baseline_symbols.txt (working copy) @@ -2633,6 +2633,7 @@ FUNC:_ZTv0_n12_NSt9strstreamD1Ev@@GLIBCXX_3.4 FUNC:_ZdaPv@@GLIBCXX_3.4 FUNC:_ZdaPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_ZdlPv@@GLIBCXX_3.4 +FUNC:_ZdlPvj@@GLIBCXX_3.4.18 FUNC:_ZdlPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_Znaj@@GLIBCXX_3.4 FUNC:_ZnajRKSt9nothrow_t@@GLIBCXX_3.4 Index: libstdc++-v3/config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt =================================================================== --- libstdc++-v3/config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt (revision 182251) +++ libstdc++-v3/config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt (working copy) @@ -2633,6 +2633,7 @@ FUNC:_ZTv0_n24_NSt9strstreamD1Ev@@GLIBCXX_3.4 FUNC:_ZdaPv@@GLIBCXX_3.4 FUNC:_ZdaPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_ZdlPv@@GLIBCXX_3.4 +FUNC:_ZdlPvm@@GLIBCXX_3.4.18 FUNC:_ZdlPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_Znam@@GLIBCXX_3.4 FUNC:_ZnamRKSt9nothrow_t@@GLIBCXX_3.4 Index: libstdc++-v3/config/abi/post/i386-linux-gnu/baseline_symbols.txt =================================================================== --- libstdc++-v3/config/abi/post/i386-linux-gnu/baseline_symbols.txt (revision 182251) +++ libstdc++-v3/config/abi/post/i386-linux-gnu/baseline_symbols.txt (working copy) @@ -2422,6 +2422,7 @@ FUNC:_ZTv0_n12_NSt9strstreamD1Ev@@GLIBCXX_3.4 FUNC:_ZdaPv@@GLIBCXX_3.4 FUNC:_ZdaPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_ZdlPv@@GLIBCXX_3.4 +FUNC:_ZdlPvj@@GLIBCXX_3.4.18 FUNC:_ZdlPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_Znaj@@GLIBCXX_3.4 FUNC:_ZnajRKSt9nothrow_t@@GLIBCXX_3.4 Index: libstdc++-v3/config/abi/post/i486-linux-gnu/baseline_symbols.txt =================================================================== --- libstdc++-v3/config/abi/post/i486-linux-gnu/baseline_symbols.txt (revision 182251) +++ libstdc++-v3/config/abi/post/i486-linux-gnu/baseline_symbols.txt (working copy) @@ -2422,6 +2422,7 @@ FUNC:_ZTv0_n12_NSt9strstreamD1Ev@@GLIBCXX_3.4 FUNC:_ZdaPv@@GLIBCXX_3.4 FUNC:_ZdaPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_ZdlPv@@GLIBCXX_3.4 +FUNC:_ZdlPvj@@GLIBCXX_3.4.18 FUNC:_ZdlPvRKSt9nothrow_t@@GLIBCXX_3.4 FUNC:_Znaj@@GLIBCXX_3.4 FUNC:_ZnajRKSt9nothrow_t@@GLIBCXX_3.4 Index: libstdc++-v3/config/abi/pre/gnu.ver =================================================================== --- libstdc++-v3/config/abi/pre/gnu.ver (revision 182251) +++ libstdc++-v3/config/abi/pre/gnu.ver (working copy) @@ -1304,6 +1304,13 @@ GLIBCXX_3.4.17 { } GLIBCXX_3.4.16; +GLIBCXX_3.4.18 { + + # operator delete(void*, , unsigned long) + _ZdlPv[jmy]; + +} GLIBCXX_3.4.17; + # Symbols in the support library (libsupc++) have their own tag. CXXABI_1.3 { Index: gcc/testsuite/g++.dg/other/sized-delete-1.C =================================================================== --- gcc/testsuite/g++.dg/other/sized-delete-1.C (revision 0) +++ gcc/testsuite/g++.dg/other/sized-delete-1.C (revision 0) @@ -0,0 +1,14 @@ +// { dg-do link} +// { dg-options "-O -fsized-delete" } +// { dg-final { scan-assembler "_ZdlPv\[mj\]" } } +struct A +{ + int a[100]; +}; + +int main(void) +{ + A *a = new A; + delete a; + return 0; +} Index: gcc/cp/decl.c =================================================================== --- gcc/cp/decl.c (revision 182251) +++ gcc/cp/decl.c (working copy) @@ -3552,6 +3552,7 @@ cxx_init_decl_processing (void) { tree void_ftype; tree void_ftype_ptr; + tree void_ftype_ptr_sizetype; /* Create all the identifiers we need. */ initialize_predefined_identifiers (); @@ -3613,8 +3614,14 @@ cxx_init_decl_processing (void) void_ftype = build_function_type_list (void_type_node, NULL_TREE); void_ftype_ptr = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE); + void_ftype_ptr_sizetype = build_function_type_list (void_type_node, + ptr_type_node, + size_type_node, + NULL_TREE); void_ftype_ptr = build_exception_variant (void_ftype_ptr, empty_except_spec); + void_ftype_ptr_sizetype + = build_exception_variant (void_ftype_ptr_sizetype, empty_except_spec); /* C++ extensions */ @@ -3669,7 +3676,7 @@ cxx_init_decl_processing (void) { tree newattrs; - tree newtype, deltype; + tree newtype, deltype, deltype2; tree ptr_ftype_sizetype; tree new_eh_spec; @@ -3704,8 +3711,10 @@ cxx_init_decl_processing (void) newtype = cp_build_type_attribute_variant (ptr_ftype_sizetype, newattrs); newtype = build_exception_variant (newtype, new_eh_spec); deltype = build_exception_variant (void_ftype_ptr, empty_except_spec); + deltype2 = build_exception_variant (void_ftype_ptr_sizetype, empty_except_spec); push_cp_library_fn (NEW_EXPR, newtype); push_cp_library_fn (VEC_NEW_EXPR, newtype); + push_cp_library_fn (DELETE_EXPR, deltype2); global_delete_fndecl = push_cp_library_fn (DELETE_EXPR, deltype); push_cp_library_fn (VEC_DELETE_EXPR, deltype); Index: gcc/cp/call.c =================================================================== --- gcc/cp/call.c (revision 182251) +++ gcc/cp/call.c (working copy) @@ -5408,8 +5408,22 @@ build_op_delete_call (enum tree_code code, tree ad usual deallocation function." So (void*) beats (void*, size_t). */ - if (FUNCTION_ARG_CHAIN (fn) == void_list_node) - break; + /* If type is not void, pick (void*, size_t) version (which comes + first). */ + if (!flag_sized_delete || TREE_CODE (type) == VOID_TYPE ) + { + /* If -fsized-delete is not passed or if a void * is deleted, + prefer delete (void *) version. */ + if (FUNCTION_ARG_CHAIN (fn) == void_list_node) + break; + } + else + { + /* If -fsized-delete is passed and it is not a void *, + prefer delete (void *, size_t) version. */ + if (FUNCTION_ARG_CHAIN (fn) != void_list_node) + break; + } } } Index: gcc/common.opt =================================================================== --- gcc/common.opt (revision 182251) +++ gcc/common.opt (working copy) @@ -1927,6 +1927,10 @@ fsingle-precision-constant Common Report Var(flag_single_precision_constant) Optimization Convert floating point constants to single precision constants +fsized-delete +Common Report Var(flag_sized_delete) Optimization +Support delete operator with objetc's size as the second parameter. + fsplit-ivs-in-unroller Common Report Var(flag_split_ivs_in_unroller) Init(1) Optimization Split lifetimes of induction variables when loops are unrolled