Skip to content
This repository was archived by the owner on Sep 19, 2026. It is now read-only.
This repository was archived by the owner on Sep 19, 2026. It is now read-only.

Cross-language link-time optimization #405

Description

@SakiiCode

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 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    • Status
      Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions