Skip to content

base: one Option/Feature registry per process in shared-object builds - #26

Merged
Force67 merged 1 commit into
devel5from
shared-registry-visibility
Sep 29, 2026
Merged

Force67 merged 1 commit into
devel5from
shared-registry-visibility

Conversation

@Force67

@Force67 Force67 commented Sep 28, 2026

Copy link
Copy Markdown
Owner

InitChain<T>::root() keeps the chain head in a function-local static of a class template. A project that builds its modules as shared objects with -fvisibility=hidden (rx's component build) instantiates that template in every .so, and each gets its own hidden root. An Option registered in one .so is then invisible to OptionBase::VisitAll in another. rx hit this: a platform config's [options] entries resolved only for options declared in the one .so doing the lookup.

BASE_SHARED_REGISTRY puts default visibility on InitChain, OptionBase and Feature. An instantiation is only as visible as its template argument, so both item types need it, not just the template. The root then becomes an ELF-unique symbol (u in nm), one per process. Static builds are unaffected.

PE has no unique binding; on Windows base would have to be a DLL for the same guarantee. The comment says so.

Verified from rx: the root is u in librx_render.so, and an [options] file naming options from five different .so files resolves all of them (before: four unresolved).

@Force67
Force67 changed the base branch from main to devel5 September 29, 2026 08:14
@Force67
Force67 merged commit be9368c into devel5 Sep 29, 2026
6 checks passed
@Force67
Force67 deleted the shared-registry-visibility branch September 29, 2026 08:15
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