-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc] Added missing operator delete generated by gcc/clang #67457
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
Conversation
@llvm/pr-subscribers-libc ChangesThis patch adds two operator delete functions that are being generated by clang 15 on rv32 (operator delete(void *mem, std::align_val_t)) and by gcc 13 on intel 64 (operator delete(void *mem, unsigned long)). Full diff: https://github.com/llvm/llvm-project/pull/67457.diff 1 Files Affected:
diff --git a/libc/test/UnitTest/HermeticTestUtils.cpp b/libc/test/UnitTest/HermeticTestUtils.cpp
index 73d54b9eeb5ecc9..d4628091f30fac2 100644
--- a/libc/test/UnitTest/HermeticTestUtils.cpp
+++ b/libc/test/UnitTest/HermeticTestUtils.cpp
@@ -109,3 +109,22 @@ void operator delete(void *) {
// we just trap here to catch any such accidental usages.
__builtin_trap();
}
+
+// Defining members in the std namespace is not preferred. But, we do it here
+// so that we can use it to define the operator new which takes std::align_val_t
+// argument.
+namespace std {
+enum class align_val_t : size_t {};
+} // namespace std
+
+void operator delete(void *mem, std::align_val_t) noexcept {
+ // The libc runtime should not use the global delete operator. Hence,
+ // we just trap here to catch any such accidental usages.
+ __builtin_trap();
+}
+
+void operator delete(void *mem, unsigned long) noexcept {
+ // The libc runtime should not use the global delete operator. Hence,
+ // we just trap here to catch any such accidental usages.
+ __builtin_trap();
+}
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't we also need this in the IntegrationTests?
It's not an issue in the integration tests currently |
Do you happen to know why this appears here and not there? I remember there was a recent patch that made the version with the alignment the default somewhere. Maybe we don't have any tests in integration that call |
I'm still investigating, but it seems that the missing references are coming from the test classes, like
I think @sivachandra mentioned on discord that changes were not required in the end. I can't find any commit that mentions the operator delete |
These
|
I also just noticed a new warning by GCC 13:
|
This patch adds two operator delete functions that are being generated by clang 15 on rv32 (operator delete(void *mem, std::align_val_t)) and by gcc 13 on intel 64 (operator delete(void *mem, unsigned long)).
2d0e2f7
to
6dd3fd7
Compare
ping We need this patch to enable fullbuild for rv32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You likely need to add these to the integration test.cpp as well.
integration tests build even without this patch |
Probably because they don't hit the same code paths, but I feel like we should do it just in case. |
Where do you want this added exactly? I can only
find ./test/integration/scudo/integration_test.cpp in libc's codebase.
Em qui., 11 de jul. de 2024 às 14:40, Joseph Huber ***@***.***>
escreveu:
… You likely need to add these to the integration test.cpp as well.
integration tests build even without this patch
Probably because they don't hit the same code paths, but I feel like we
should do it just in case.
—
Reply to this email directly, view it on GitHub
<#67457 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKEJHYJC5MGN45PWXWIVS3ZL27Q7AVCNFSM6AAAAABKNEDSJ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRTGUYTOMJUGY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Mikhail R. Gadelha, Ph.D.
|
Do yo mean
I still prefer not to add code unless it's needed. Will you block the PR if I don't add the code there? |
Honestly, these files are practically the same so we could probably just merge them into a single object library or something. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The integration test stuff doesn't have any of these operators, so I guess it's moot. That being said, this is pretty much just a wrapper to work in a hermetic environment given LIBC_NAMESPACE qualified identifiers, we could merge them in the future.
Summary: This patch adds two operators delete that are being generated by clang 15 on rv32 (operator delete(void *mem, std::align_val_t)) and by gcc 13 on intel 64 (operator delete(void *mem, unsigned long)). Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60251538
This patch adds two operator delete functions that are being generated by clang 15 on rv32 (operator delete(void *mem, std::align_val_t)) and by gcc 13 on intel 64 (operator delete(void *mem, unsigned long)).