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.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.