-
Notifications
You must be signed in to change notification settings - Fork 64
Description
Summary
Add support in csolution / cbuild to mark individual static libraries in a cproject as requiring whole-archive semantics, and propagate this to the generated CMake using CMake link features (generator expressions).
Problem
When static libraries are linked normally, the linker only pulls object files that satisfy unresolved symbols. Libraries that rely on static initialization or self-registration (e.g. kernel registries, plugin-style components) break when packaged as .a files, even though they work when linked as source.
Proposed Solution
Allow a per-library attribute in cproject that requests whole-archive behavior, mapped by cbuild to CMake link features.
Example:
- group: ExecuTorch Libraries
files:
- file: ./engine/lib/libexecutorch_core.a
- file: ./engine/lib/libportable_kernels.a
attributes: [whole-archive]
- file: ./engine/lib/libcortex_m_kernels.a
attributes: [whole-archive]
cbuild generates CMake that applies whole-archive semantics only to the annotated libraries (equivalent to --whole-archive / --no-whole-archive).
Reference
CMake link features / generator expressions:
https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#link-features
Metadata
Metadata
Assignees
Labels
Type
Projects
Status