Re: new c++ new/delete overloads need wrapping?

2025年8月02日 04:36:36 -0700

Jeremy Drake via Cygwin writes:
> I was looking into C++ new/delete --wrap linker options, and noticed that
> in a quick test the wrapper for delete was not being called. This was
> because delete is being compiled to _ZdlPvm and that symbol is not present
> in the --wrap arguments in the GCC spec, and is not part of the
> per_process_cxx_malloc struct. I'm not seeing anything in that cxx_malloc
> struct like a size or version number, so I don't know a good way to
> extend it given that it is part of the startup code linked into every
> binary.
So, something like this?
--8<---------------cut here---------------start------------->8---
diff --git a/gcc/config/i386/cygwin-w64.h b/gcc/config/i386/cygwin-w64.h
index 8180d27c971..177e8203715 100644
--- a/gcc/config/i386/cygwin-w64.h
+++ b/gcc/config/i386/cygwin-w64.h
@@ -28,13 +28,24 @@ along with GCC; see the file COPYING3. If not see
 malloc-like operators. See N2800 #17.6.4.6 [replacement.functions] */
 #undef CXX_WRAP_SPEC_LIST
 #define CXX_WRAP_SPEC_LIST " \
- --wrap _Znwm \
- --wrap _Znam \
- --wrap _ZdlPv \
- --wrap _ZdaPv \
+ --wrap _ZnwmSt11align_val_tRKSt9nothrow_t \
+ --wrap _ZnwmSt11align_val_t \
 --wrap _ZnwmRKSt9nothrow_t \
+ --wrap _Znwm \
+ --wrap _ZnamSt11align_val_tRKSt9nothrow_t \
+ --wrap _ZnamSt11align_val_t \
 --wrap _ZnamRKSt9nothrow_t \
+ --wrap _Znam \
+ --wrap _ZdlPvmSt11align_val_t \
+ --wrap _ZdlPvm \
+ --wrap _ZdlPvSt11align_val_tRKSt9nothrow_t \
+ --wrap _ZdlPvSt11align_val_t \
 --wrap _ZdlPvRKSt9nothrow_t \
+ --wrap _ZdlPv \
+ --wrap _ZdaPvmSt11align_val_t \
+ --wrap _ZdaPvm \
+ --wrap _ZdaPvSt11align_val_tRKSt9nothrow_t \
+ --wrap _ZdaPvSt11align_val_t \
 --wrap _ZdaPvRKSt9nothrow_t \
 "
 
--8<---------------cut here---------------end--------------->8---
The symbols were in reverse order, so I kept it that way.
Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
Factory and User Sound Singles for Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds
-- 
Problem reports: https://cygwin.com/problems.html
FAQ: https://cygwin.com/faq/
Documentation: https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple

Reply via email to