Skip to content

Fix hot reload with libstdc++ involved - #1715

Merged
Bromeon merged 2 commits into
masterfrom
bugfix/linux-reload-libstdcxx
Oct 19, 2026
Merged

Bromeon merged 2 commits into
masterfrom
bugfix/linux-reload-libstdcxx

Conversation

@Bromeon

@Bromeon Bromeon commented Oct 18, 2026

Copy link
Copy Markdown
Member

Closes #1209.

I reproduced the behavior and attempted a fix. It needed a bit of hacking with exported symbols (including global_asm! due to no stable Rust way), but seems to work.

@AJ213 please see if this fixes things for you.

Dependencies with C++ code pull in libstdc++, which is never unloaded
by glibc. The hot-reload crate now has a `cpp-dependency` feature.
This links libstdc++, reproducing hot-reload failures.
Godot loads extensions with `RTLD_DEEPBIND`, so libstdc++ resolved its
`__cxa_thread_atexit_impl` import to our exported override instead of glibc's
own one. libstdc++ is not unloaded -> extension stays pinned, statics become stale.

Now hides the symbol via asm trampoline (no stable way). Rust std still links
to it. Re-initialization without unload now panics, also in release builds.
@Bromeon Bromeon added bug c: ffi Low-level components and interaction with GDExtension API labels Oct 18, 2026
@GodotRust

Copy link
Copy Markdown

API docs are being generated and will be shortly available at: https://godot-rust.github.io/docs/gdext/pr-1715

@AJ213

AJ213 commented Oct 19, 2026

Copy link
Copy Markdown

Checked on my end, this fixes the issue and my project now editor hotreloads. Thank you! @Bromeon

@Bromeon
Bromeon added this pull request to the merge queue Oct 19, 2026
Merged via the queue into master with commit 395476d Oct 19, 2026
17 checks passed
@Bromeon
Bromeon deleted the bugfix/linux-reload-libstdcxx branch October 19, 2026 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug c: ffi Low-level components and interaction with GDExtension API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hotreload Enabled Twice On Linux Leading to Panic

3 participants