If one were to try to exploit a binary file, would it make a difference if the executable is produced by a specific compiler and linker?
I'll elaborate the problem. I am trying to understand how windows exploitation works. I have a source code file written in C. I can use the 'cl' compiler from Microsoft or the GNU gcc compiler. Would both of these produce the same executable so both can be exploited the same way OR the executable would be different and subsequently the exploitation would be different? If they are different, what are the differences that I should take into account?
If one were to try to exploit a binary file, would it make a difference if the executable is produced by a specific compiler and linker?
Generally, yes. Exploits of binary programs usually depend on the exact memory layout and sequence of machine instructions in the program. This will vary when different compilers are used to build the program - or even, as David C. Rankin points out, the same compiler with different options.
Would both of these produce the same executable so both can be exploited the same way OR the executable would be different and subsequently the exploitation would be different?
They will typically be different. Some types of exploits might work the same on both, if you are lucky, but it depends on exactly what the exploit is doing. For instance, it could happen that:
The same exploit works for the new build without change
The same basic attack works, but addresses have to be changed due to different memory layout
The exploit is still possible, but requires completely different techniques
The exploit is no longer possible, either by coincidence or intentional countermeasures implemented by this compiler (stack guard, address randomization, etc).
If they are different, what are the differences that I should take into account?
Too broad to answer. In general you may have to start completely from scratch in analyzing the behavior of the program as built by the second compiler, to determine whether it is still exploitable, and if so how it can be accomplished.