hn.today

Paths in Pieces

stoppels.ch29 points0 comments
Screenshot of Paths in Pieces

Build systems and package managers often scan binaries for embedded build-directory paths, treating their presence as evidence that a program may fail after installation elsewhere. The essay shows why simple text searches can miss those paths: GCC may turn a string copied into a buffer, such as a C++ std::string, into overlapping 16-byte vector constants rather than storing the original text contiguously. A program can print the full path even though neither grep nor strings finds it. With a Conda-style padded prefix, GCC can also deduplicate repeating chunks, leaving only a shorter, incomplete path in the binary. Strings used only through pointers, by contrast, generally remain intact.

The optimization appears to offer little performance benefit over Clang’s approach, which stores the literal and copies overlapping vector-width chunks. It can increase binary size unless repeated pieces allow deduplication, and it undermines both path audits and in-place prefix rewriting used by tools such as Conda and Spack. GCC enables this for strings up to 256 bytes by default, with larger limits for wider vector targets; compiling with -Os or constraining vector width can limit it, but not eliminate it. The author argues that reproducible-build checks are a stronger defense against machine-specific data, yet literal strings remain valuable for inspecting binaries and for path patching. Keeping them intact may therefore matter more than modest size savings.

Read on stoppels.ch0 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

Ggml v1.0.0

Ggml v1.0.0

ggml 1.0.0 removes deprecated public APIs and legacy DIAG_MASK operations, while adding configurable YaRN truncation and FP8 support. It also improves backend performance with quantized matrix multiplication, fused MoE operations, and new attention and scheduling paths. (github.com)

The daily digest

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