Skip to content

[5.7][Runtime] Define our own hidden global new/delete on Darwin. #58913

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

Merged
merged 1 commit into from
May 17, 2022

Conversation

mikeash
Copy link
Contributor

@mikeash mikeash commented May 13, 2022

Cherry-pick #58911 to release/5.7.

On Darwin, define our own, hidden operator new/delete implementations. We don't want to pick up any overrides that come from other code, but we also don't want to expose our overrides to any other code. We can't do this directly in C++, as the compiler has an implicit prototype with default visibility. However, if we implement them as C functions using the C++ mangled names, the compiler accepts them without complaint, and the linker still links all internal uses with these overrides.

rdar://92795919

@mikeash mikeash requested a review from a team as a code owner May 13, 2022 23:03
@mikeash
Copy link
Contributor Author

mikeash commented May 13, 2022

@swift-ci please test

@mikeash mikeash changed the title [Runtime] Define our own hidden global new/delete on Darwin. [5.7][Runtime] Define our own hidden global new/delete on Darwin. May 13, 2022
On Darwin, define our own, hidden operator new/delete implementations. We don't want to pick up any overrides that come from other code, but we also don't want to expose our overrides to any other code. We can't do this directly in C++, as the compiler has an implicit prototype with default visibility. However, if we implement them as C functions using the C++ mangled names, the compiler accepts them without complaint, and the linker still links all internal uses with these overrides.

rdar://92795919
(cherry picked from commit db1203a)
@mikeash mikeash force-pushed the internal-new-delete-5.7 branch from 3515d0b to 8c423b2 Compare May 16, 2022 20:22
@mikeash
Copy link
Contributor Author

mikeash commented May 16, 2022

@swift-ci please test

@mikeash mikeash merged commit cb06c42 into swiftlang:release/5.7 May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants