Skip to content

Replace call to objc_addLoadImageFunc().#1536

Draft
grynspan wants to merge 9 commits intomainfrom
jgrynspan/169186671-replace-objc_addLoadImageFunc
Draft

Replace call to objc_addLoadImageFunc().#1536
grynspan wants to merge 9 commits intomainfrom
jgrynspan/169186671-replace-objc_addLoadImageFunc

Conversation

@grynspan
Copy link
Contributor

@grynspan grynspan commented Feb 9, 2026

This PR replaces our use of objc_addLoadImageFunc() with calls to objc_copyImageNames(), dlopen(), and _dyld_get_dlopen_image_header(). This is a bit less efficient, but it avoids the problem of deadlocking if we happen to touch Swift API/internals that need to acquire the lock that libobjc is holding during objc_addLoadImageFunc()'s callback.

Resolves rdar://169186671.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

@grynspan grynspan added this to the Swift 6.4.0 (main) milestone Feb 9, 2026
@grynspan grynspan self-assigned this Feb 9, 2026
@grynspan grynspan added enhancement New feature or request darwin 🍎 macOS, iOS, watchOS, tvOS, and visionOS support discovery 🔎 test content discovery tech-debt 💾 reduces technical debt labels Feb 9, 2026
Base automatically changed from jgrynspan/drop-old-darwin-support to main February 11, 2026 15:59
This PR replaces our use of `objc_addLoadImageFunc()` with calls to
`objc_copyImageNames()`, `dlopen()`, and `_dyld_get_dlopen_image_header()`. This
is a bit less efficient, but it avoids the problem of deadlocking if we happen
to touch Swift API/internals that need to acquire the lock that libobjc is
holding during `objc_addLoadImageFunc()`'s callback.

Resolves rdar://169186671.
@grynspan grynspan force-pushed the jgrynspan/169186671-replace-objc_addLoadImageFunc branch from 3e036bc to 9b5ebb9 Compare February 13, 2026 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

darwin 🍎 macOS, iOS, watchOS, tvOS, and visionOS support discovery 🔎 test content discovery enhancement New feature or request tech-debt 💾 reduces technical debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant