Repository navigation
Keep backend objects in static builds with GCC and Clang - #135
Merged
Merged
Conversation
Closed
1 of 2 tasks
Orinks
added a commit
to orinks-games/Freight-Fate
that referenced
this pull request
Oct 2, 2026
prismer 0.1.4 vendors Prism 0.18.3, which loads the optional Windows screen-reader DLLs (PC-Talker, ZDSR, BoyPCReader) with LoadLibrary and Linux's libspeechd with dlopen, and anchors its backends for GCC and Clang (ethindp/prism#135, #136, #146). So build.rs no longer emits the /DELAYLOAD list, the /INCLUDE of the delay-load failure hook, the whole-archive link of libprism.a, or a link of speech-dispatcher. The release exe now has no delay imports at all, and --list-speech-backends reports every absent reader as not installed instead of risking 0xC06D007E. On Linux the game starts without Speech Dispatcher; the nightly's Debian, Ubuntu and openSUSE boots now run without its client library to prove it, while Fedora still has to pick it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #130.
A static prism linked with GCC or Clang registers no backends unless the archive is linked whole.
gnu::usedandgnu::retainkeep a registrar inside its own object, but nothing references a backend's object, so the linker never pulls it out of the archive in the first place. #125 solved this for MSVC with/include:directives. Every other toolchain was still relying on the attributes.What this does
The anchors #125 added are already emitted on every compiler. The generated
backend_anchors.hnow also covers GCC and Clang: it declares each backend's anchor and takes its address in a[[gnu::used]]array. The header is included byprism.cpp, which the linker always keeps because the application callsprism_init, so those references pull every backend object in. MSVC keeps its directives, unchanged.The header is generated and included on every platform now, rather than only under MSVC.
Testing
The reproduction from #130, on GitHub's runners, linking
libprism.awith no--whole-archiveor-force_load:Ubuntu 24.04, GCC 13.3 (
speech_dispatcher=on):macOS, Apple Clang (
avspeech=on voiceover=on):The MSVC static build was checked as well, in a .NET Native AOT application that links
prism.liband lists its backends on x64, x86 and ARM64.