You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 19, 2026. It is now read-only.
Rust has support for cross-language LTO called Linker-plugin-based LTO and it can further decrease binary size with minimal configuration. Not only ESP-IDF could benefit from it but also every other Rust crate that pulls in C code.
Solution
Unfortunately it needs clang as the C compiler and linker. I saw that ldproxy only supports gcc and simply replacing it with clang or linker-flavor=ld.lld gives a lot of unrecognized command line options. I only tried the Xtensa architecture so far.
Has anyone experimented with this? Is it possible to change the linker to clang and pass -flto=full to the compiler? Can I read somewhere about why ldproxy had to be created?
Alternatives
Add clang support for ldproxy
Additional context
In my testing this can make a 15% reduction in binary size
If this is too difficult to implement or does not belong here, feel free to close this issue
Motivations
Rust has support for cross-language LTO called Linker-plugin-based LTO and it can further decrease binary size with minimal configuration. Not only ESP-IDF could benefit from it but also every other Rust crate that pulls in C code.
Solution
Unfortunately it needs
clangas the C compiler and linker. I saw thatldproxyonly supports gcc and simply replacing it withclangorlinker-flavor=ld.lldgives a lot of unrecognized command line options. I only tried the Xtensa architecture so far.Has anyone experimented with this? Is it possible to change the linker to clang and pass
-flto=fullto the compiler? Can I read somewhere about why ldproxy had to be created?Alternatives
Add clang support for ldproxy
Additional context
In my testing this can make a 15% reduction in binary size
If this is too difficult to implement or does not belong here, feel free to close this issue