hn.today

Stop Linking by Symbol

fzakaria.com30 points10 comments
Screenshot of Stop Linking by Symbol

The argument is that conventional dynamic linking does unnecessary work on every process launch, even in immutable systems such as Nix, where libraries remain unchanged. Earlier tools addressed successive costs: Shrinkwrap records exact library paths to avoid directory searches, and MatR precomputes which library provides each symbol to avoid repeated name lookups. But the loader still patches a separate Global Offset Table entry for every symbol, so startup time and memory use grow with the number of symbols. Because symbol offsets within a fixed library do not change, only the library’s load address needs to be determined at runtime.

storeld uses that property to link by store path rather than by symbol. It generates call stubs at build time that read one base pointer per library and add a fixed symbol offset, avoiding per-symbol GOT entries and runtime relocation work. It works with unchanged C source and a stock linker, using a build hook and replacing the usual dynamic linker with storeld-run. In a scaling test with up to 200,000 symbols, storeld’s startup latency and private memory use stayed nearly constant, while traditional linking costs rose; the reported comparison at the high end was 0.88 ms versus 43.38 ms. The approach also removes ld.so, writable GOT pages, and IFUNCs, which the author argues improves security and makes dependencies more explicit. More broadly, immutable software stores offer opportunities to redesign systems around stability rather than assuming everything can change.

Read on fzakaria.com10 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

Show HN: Rust Commander

Show HN: Rust Commander

Rust Commander is a Rust terminal file manager modeled on Midnight Commander, with dual-pane navigation, a persistent shell, archive and remote browsing, and background file operations. Version 0.3.1 adds file-change alerts, viewer copy controls, customizable skins, and faster SFTP previews and copying. (github.com)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.