-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
overloaded delete not called when using sections garbage collection #132
Comments
thanks for the report.
What should happen with replaceable new/delete is that the linker chooses the non-weak replacement (provided by the user) in preference to the weak version (provided by libstdc++/libc++) In principle, -dead_strip in the linker should not make any difference to this. I think we need to test this on unpatched upstream trunk (on x86_64) and double-check we are emitting things correctly (if were are, then this is a linker bug). |
For the record, in case that seems like a bad thing, this is an ELF-ism. Mach-O has a different (and internally automatic) mechanism which is triggered by .subsections_by_symbols. In this (so-called 'atom') model, we can split code or data on any linker-visible symbol (thus it is actually more fine-grained than ffunction/data-sections and does not require the user to specify it, it is on by default). |
Thank you for explaining this.
I'm afraid this is a bit too much for me... It is also curious why the issue is not observed when using C++11. |
that's fine - it is something for me to check - but I want to do that on the upstream code (not this branch) because we should not have made any changes to this behaviour in the patches to support arm64.
me too :) |
The problem seems to be fixed on 14.2, all my tests passed, on both x64 and arm64: |
I have a small test that overloads new/delete, calls them and checks if the overloaded functions were really called:
With the default configuration the test passes, both
new
anddelete
are accounted as called.If I use section garbage collection,
delete
is not called.However, if I set the standard to c++11, it works as expected.
The test is borrowed with permission from Martin Storsjö, the llvm-mingw project.
g++-14
is from Homebrew, but I noticed this behaviour with by GCC 14 & 13 too.For my tests I'm tempted to add
-std=c++11
and hide the issue, but I thought to report it, perhaps for older sources it might be relevant.The text was updated successfully, but these errors were encountered: