5 ms·
That'd make process startup EXTREMELY slow
by xxpor 4y ago
That'd make process startup EXTREMELY slow
- speed_spread 4y agoNot that bad if you link with a custom mold fork.
- jchw 4y agoIt's pretty much what OpenBSD is doing at bootup. Truthfully though you're right, using typical linkers, this would be pretty slow; at least a few seconds for large binaries, to minutes for things as large as web browsers. However, for many binaries, linking can be done much faster; mold claims to be only 50% the runtime of using `cp` on the object files, which is fast enough to even re-link Firefox on-the-fly without it being unusable. You could imagine writing a linker specifically for this case, that encodes information about the object files directly into the resulting bundle.
- blibble 4y agoI thought openbsd did it after boot?
- dfox 4y agoOpenBSD relinks sshd. Which is relatively small thing that is linked from relatively large objects (ie. it is the typical modern C code). Relinking thing like glibc on demand is going to be problematic, because it is structured as to allow small binary sizes for static linking and thus almost every function that is part of glibc API is a separate compilation unit and object file. Linking that into .so is slow, no mater what kind of optimalization tricks you implement in the linker.
- blibble 4y agodoesn't matter how long it takes if you don't block the boot process doing it you can link in the background at idle priority, and if you don't complete before reboot: no big deal
- saagarjha 4y agoRelinking glibc would block the boot process.
- blibble 4y agohow? it's a dynamic library, and this isn't windoze with awful mandatory locking as long as the underlying version is unchanged: there should be no problem whatsoever
- saagarjha 4y agoglibc is going to get used by everything in userspace, so you’ll need it when you boot.
- blibble 4y agoyes... it is there at boot then after boot you relink for next boot
- account42 4y agoYes, but this thread is about doing the linking after boot. It doesn't matter if you link synchronously before you start the program or link asynchronously after you start the program - you will still get a new unique binary for each boot.
- jchw 4y agoYeah. That said, I'm suggesting that if it was really too slow, though, it'd probably be infeasible to relink libc, the kernel, etc. at bootup. It's not a direct comparison to be sure.