I want to add my C++ source code to the corresponding elf binary file and I’m looking for the best way to do this. (I’m using several versions of my code and not every version should be committed into svn).
Can I just append the source code without destroying the elf file using bash’s >> operator?
Or is objcopy --add-section a way to do this?
By the way, is there a better idea that just grep‘ing all #include lines recursively from the source code files to determine ALL source code files that are used?
If you’re using gcc you could use the -M flag to get a file with a list of all included files. It’s written to the file specified with -o, like this: