Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build static PIE binaries with clang #88

Merged
merged 1 commit into from
Dec 2, 2024
Merged

Build static PIE binaries with clang #88

merged 1 commit into from
Dec 2, 2024

Conversation

TheAssassin
Copy link
Member

gcc is not capable of linking with -static-pie, therefore we switch to using clang.

This PR allows us to use https://github.com/io12/userland-execve-rust and apparently also AppImageLauncher's binfmt-bypass (via TARGET_APPIMAGE) to run AppImages with this static runtime.

Fixes #87.

Copy link

Build for testing:
artifacts i686
artifacts x86_64
artifacts armhf
artifacts aarch64
Use at your own risk.

Copy link

Build for testing:
artifacts x86_64
artifacts i686
artifacts armhf
artifacts aarch64
Use at your own risk.

@probonopd
Copy link
Member

Can you please add a table comparing binary sizes? Does RAM consumption change?

@TheAssassin
Copy link
Member Author

TheAssassin commented Nov 28, 2024

The size difference is negligible and I don't think that any RAM consumption would change. I don't see any reason for it. And it wouldn't change the runtime efficiency either. Loading might be delayed by a few nanoseconds to fire up an RNG.

Edit: the major difference in size is between compilers. From my observations, a ~7% increase in size is to be expected with clang.

Copy link
Member

@probonopd probonopd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming that the increased binary size comes from switching from gcc to clang. Maybe we can experiment with some -O options to reduce binary sizes independently from this PR. Approving this under the working hypothesis that this has no ill side effects but helps e.g., tools like AppImageLauncher. In case it turns out to be problematic, we'd have to revert it.

gcc is not capable of linking with -static-pie, therefore we switch to
using clang.
@TheAssassin
Copy link
Member Author

You could file a bug upstream @ Alpine regarding the gcc compiler bug, then we could switch back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants