Skip to content

fix(cli): preserve zero-filled Mach-O TLS initializers during hot patches - #5875

Open
andrewtdiz wants to merge 1 commit into
DioxusLabs:mainfrom
andrewtdiz:fix/macos-tls-bss-initializers
Open

andrewtdiz wants to merge 1 commit into
DioxusLabs:mainfrom
andrewtdiz:fix/macos-tls-bss-initializers

Conversation

@andrewtdiz

Copy link
Copy Markdown

Mach-O thread-local zero-fill symbols are absent from the hot-patch cache's initializer size map. When creating a stub for one of these symbols, the missing-symbol fallback copies unrelated nonzero __thread_data bytes. In a native Dioxus0.7.10 app, a component-body patch consequently produced std::thread::AccessError while allocating its template signal; the thread-local owner storage contained an invalid state byte.

Index both initialized and zero-fill TLS sections, preserve each initializer's adjacent-symbol size, and encode zero-fill entries without a source-data offset. Stub construction then emits zero bytes for BSS while preserving initialized data. This retains the existing preprocessing complexity and adds no callback-time work.

The regression builds a real AArch64 Mach-O object with one nonzero initialized TLS value and two differently sized BSS values, then checks their extracted initializer bytes and sizes.

Validation: dioxus-cli TLS regression passes on current main (1passed,161filtered; dev build, assertions enabled). The same test passes onv0.7.10. A live native component patch with the v0.7.10 fix preserves process, game state and Dioxus hook state. The existing TLS rewrite in#5291 andv0.8.0-alpha.1 retain the missing BSS initializer path; this addresses that case separately.

This branch has not been deployed

No deployments
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.

1 participant