Well, of course the easiest way to relate hello.c to hello.out is run gcc hello.c and compare the output to hello.out. In fact, it's probably the only reliable way, and you'd better use the same version of gcc. If you used a different version of gcc or another compiler, you *might* be able to use sequence matching (as is used for comparing DNA sequences and plagiarized text) to see if stretches of the compiled code are "similar enough". You'd have to set up some arbitrary criteria, and there would be false positives and negatives.
Reversing the process is probably not even theoretically possible, as there isn't a 1:1 reversible mapping between source code and compiled code.
Running a continuous audit on all uses of gcc would work too, for all future compilations.
Last edited by mostlyharmless; 10-22-2009 at 03:34 PM.