There is a portable way to encode files in an executable: you encode your files in specific structure. Ex:
// header MyFile.h
static const int fileSizeInBytes = 42;
extern const unsigned char myFileContents[fileSizeInBytes];
// source MyFile.cpp
const unsigned char myFileContents[fileSizeInBytes] =
{
0x0A, 0x35, 0x25, //...
// ...
0xAB, 0xCD, 0xEF
};
You can find some tools for automatically generating those files (for example, with Qt, there is rcc).
Also, there is a more specific answer here (Windows, PE format). You can also look here (although it's for the Irrlicht Engine, the code is rather clear and small, easily understandable) (still for PE format).
I don't know for the ELF format.