Basically it works that a compiler generates assembler output from your C file and it is passed to the assembler and finally to the linker which output the format yo tell him (bin, shex, i-hex etc..)
in general, compilers generate object files, the linker takes the object files, links them together and generates the final output file. So hex or bin or other file types are linker options, not compiler.