Skip to content

Compile using -C linker-plugin-lto #46

Description

@lberrymage

Below are the current binary sizes for libina.so in the Android library:

libina.so (aarch64-linux-android): 504.9 KiB
libina.so (x86_64-linux-android): 619.9 KiB

Applying -C linker-plugin-lto via .config/cargo.toml results in the following binary sizes:

libina.so (aarch64-linux-android): 450.1 KiB
libina.so (x86_64-linux-android): 554.0 KiB

These are reductions in size by 10.9% and 10.6% respectively.

We should find the correct way to apply -C linker-plugin-lto and/or other measures to further reduce the binary size of our Android artifacts. This requires some work because linker errors occur without care, e.g., the ina CLI won't build on x86_64-unknown-linux-gnu with this flag enabled. It seems we need to figure out how to set clang as the default cc and linker and ensure this works properly on Windows and macOS as well.

For more information, see https://doc.rust-lang.org/rustc/linker-plugin-lto.html.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions