I’m writing an interpreter, and want to construct the executable so that the interpreter’s source code can be appended to the executable. To do this, i need to know how large the executable was when the linker wrote it to disk.
I’ve dug around and googled up a lot of not-workable approaches. It seems like the linker should have some predefined constant for “final module size” or suchlike, but i’m not finding anything that looks like that. I’m a bit leery of approaching the SECTIONS business of the linker but maybe that’s the only thing left.
Has anyone gone through this exercise? TIA.