Skip to content

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Jan 27, 2025

This PR removes Stubs.cpp, which currently houses some thunks for functions that are conditionally unavailable in glibc, and replaces it with runtime function lookups in Swift. Is there potentially a one-time non-zero performance cost? Yes. Is that performance cost prohibitive given that the functions are only looked up once and then cached? No.

These functions won't get called on Linux if SWT_NO_DYNAMIC_LINKING is defined but we don't currently support that combination anyway. Even if you're using a statically-linked Swift standard library, we'd expect Linux to still support calling dlsym().

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.
This PR removes Stubs.cpp, which currently houses some thunks for functions that are conditionally unavailable in glibc, and replaces it with runtime function lookups in Swift. Is there potentially a one-time non-zero performance cost? Yes. Is that performance cost prohibitive given that the functions are only looked up once and then cached? No. These functions won't get called on Linux if `SWT_NO_DYNAMIC_LINKING` is defined but we don't currently support that combination anyway. Even if you're using a statically-linked Swift standard library, we'd expect Linux to still support calling `dlsym()`.
@grynspan grynspan added linux 🐧 Linux support (all distros) less-c++ 🐀 Work to reduce the size of our C++ codebase and/or dependencies labels Jan 27, 2025
@grynspan grynspan added this to the Swift 6.x milestone Jan 27, 2025
@grynspan grynspan self-assigned this Jan 27, 2025
@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan grynspan merged commit 95b97a6 into main Jan 27, 2025
3 checks passed
@grynspan grynspan deleted the jgrynspan-remove-stubs-cpp branch January 27, 2025 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

less-c++ 🐀 Work to reduce the size of our C++ codebase and/or dependencies linux 🐧 Linux support (all distros)

3 participants