linkme is a tool for collecting elements across crates during linking. We use it to maintain trap callbacks.
Why
However, there are currently the following issues:
-
The trap callback slice we create using linkme will only have 0 or 1 items. It's somewhat overkill.
-
It doesn't work well on bare metal (target_os = "none"), because bare metal applications typically require writing a linker script and then maintaining each used linkme section (linkme_XXX/linkm2_XXX), otherwise it will become Orphan Sections, and then be placed in a (potentially inappropriate) location by the linker.
Possible Alternatives
- Use
crate_interface or similar methods to leverage weak symbols to define trap callbacks.
- Patch
linkme and rename the generated symbols to .rodata.xxx, etc., which might solve the problem (unverified).
linkmeis a tool for collecting elements across crates during linking. We use it to maintain trap callbacks.Why
However, there are currently the following issues:
The trap callback slice we create using
linkmewill only have 0 or 1 items. It's somewhat overkill.It doesn't work well on bare metal (
target_os = "none"), because bare metal applications typically require writing a linker script and then maintaining each usedlinkmesection (linkme_XXX/linkm2_XXX), otherwise it will become Orphan Sections, and then be placed in a (potentially inappropriate) location by the linker.Possible Alternatives
crate_interfaceor similar methods to leverage weak symbols to define trap callbacks.linkmeand rename the generated symbols to.rodata.xxx, etc., which might solve the problem (unverified).