Paths in pieces

Nov 12th, 2026

Many[1][2][3][4][5][6][7][8][9] Linux distributions and package managers audit just-built binaries for non-relocatable absolute paths. If a binary contains a path /path/from/build/machine, it might not run on the end-user's machine.

Now, a basic grep on the binary, or a slightly more sophisticated

$ strings bin/app | grep /path/from/build/machine

using GNU binutils's strings will detect these paths, right?

The answer is no, at least when using GCC and targeting x86-64: you should not assume that string constants end up literally in the binary.

Basic example

In this C++ source we create a std::string from a string constant: