-
Notifications
You must be signed in to change notification settings - Fork 78
Support -Zfunction-sections #118
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
While it helps, it helps not nearly as much as I would have hoped. Even with optimizations the executable is bigger than with cg_clif which doesn't do optimizations. |
I think this perturbed the test executable just enough to expose an existing bug. |
You already found a similar bug a few weeks ago. You had commented the test for unaligned slice. I started working on this but wasn't able to fix the issue yet. Somehow, the global variable I needed to be aligned on 4 bytes is aligned on 1 byte because that's what rustc says. So, I still need to dig into this to figure out what's happening. |
Should be fixed in #121. The branches in my gcc fork are currently a mess. I'll fix the master branch if needed. |
I had forgotten to build the libgccjit artifact. Now it's done and the core tests pass. |
This puts every function and data object in their own section. This allows the linker to omit unused functions and data objects with --gc-sections. On linux this shrinks a hello world binary without optimizations (neither sysroot nor binary) from 17MB to 13MB. It shrinks a hello world binary with only sysroot optimizations from 14MB to 13MB. For comparison cg_llvm produces a 3.5MB debug mode hello world binary with an optimized sysroot. Cg_clif produces a 10MB debug mode hello world binary without an optimized sysroot.
7f778e9
to
99941cd
Compare
Rebased to trigger CI. |
This puts every function and data object in their own section. This allows the linker to omit unused functions and data objects with
--gc-sections
.On linux this shrinks a hello world binary without optimizations (neither sysroot nor binary) from 17MB to 13MB. It shrinks a hello world binary with only sysroot optimizations from 14MB to 13MB. For comparison cg_llvm produces a 3.5MB debug mode hello world binary with an optimized sysroot. Cg_clif produces a 10MB debug mode hello world binary without an optimized sysroot.
Fixed #117