Unmapping Embedded Executable Data on Linux

In C and C++ programs, it’s quite common to embed binary data directly in executables. Two straightforward ways are: // C23 #embed const unsigned char texture[] = { #embed "texture.png" }; // Or xxd codegen'd array const unsigned char texture_png[] = { 0x89, 0x50, 0x4e, 0x47, /* ... */ }; unsigned int texture_png_len = 12345; This is quite convenient. The data is now part of the executable, and you don’t need to worry about shipping separate files. It works well, but has a limitation I was recently thinking about. ...

January 28, 2026 · 5 min