logoalt Hacker News

Binaries

47 pointsby todsacerdotitoday at 5:35 AM18 commentsview on HN

Comments

geriksontoday at 6:48 AM

The HN de-sensationalize algo for submission titles needs tweaking. Original title is simply "Huge Binaries".

show 1 reply
10000truthstoday at 10:33 AM

Debug symbol size shouldn't be influencing relocation jump distances - debug info has its own ELF section.

Regardless of whether you're FAANG or not, nothing you're running should require an executable with a 2 GB large .text section. If you're bumping into that limit, then your build process likely lacks dead code elimination in the linking step. You should be using LTO for release builds. Even the traditional solution (compile your object files with -ffunction-sections and link with --gc-sections) does a good job of culling dead code at function-level granularity.

yjftsjthsd-htoday at 7:50 AM

> I had observed binaries beyond 25GiB, including debug symbols. How is this possible? These companies prefer to statically build their services to speed up startup and simplify deployment. Statically including all code in some of the world’s largest codebases is a recipe for massive binaries.

I am very sympathetic to wanting nice static binaries that can be shipped around as a single artifact[0], but... surely at some point we have to ask if it's worth it? If nothing else, that feels like a little bit of a code smell; surely if your actual executable code doesn't even fit in 2GB it's time to ask if that's really one binary's worth of code or if you're actually staring at like... a dozen applications that deserve to be separate? Or get over it the other way and accept that sometimes the single artifact you ship is a tarball / OCI image / EROFS image for systemd[1] to mount+run / self-extracting archive[2] / ...

[0] Seriously, one of my background projects right now is trying to figure out if it's really that hard to make fat ELF binaries.

[1] https://systemd.io/PORTABLE_SERVICES/

[2] https://justine.lol/ape.html > "PKZIP Executables Make Pretty Good Containers"

show 2 replies
stnclstoday at 8:28 AM

> The simplest solution however is to use -mcmodel=large which changes all the relative CALL instructions to absolute JMP.

Makes sense, but in the assembly output just after, there is not a single JMP instruction. Instead, CALL <immediate> is replaced with putting the address in a 64-bit register, then CALL <register>, which makes even more sense. But why mention the JMP thing then? Is it a mistake or am I missing something? (I know some calls are replaced by JMP, but that's done regardless of -mcmodel=large)

doubletwoyoutoday at 7:01 AM

25 GiB for a single binary sounds horrifying

at some point surely some dynamic linking is warranted

show 3 replies
a_t48today at 7:58 AM

I've seen terrible, terrible binary sizes with Eigen + debug symbols, due to how Eigen lazy evaluation works (I think). Every math expression ends up as a new template instantiation.

show 1 reply