I am sorry if this is not the right place for this but probably somebody will find this useful.
As far as I understand, Intel C compiler 17.0.2 uses 'cpp' and 'as' when processing assembly files (.S). It's possible that they reside in different directories: /path/to/gcc/bin and /path/to/binutils/bin. If we want to use that specific 'cpp' and that specific 'as' we can just add them to PATH before compiling. Unfortunately, it's not very good to modify PATH variable for my workflow in particular. So, I tried to use icc's command line flags:
icc -gnu-prefix=/path/to/binutils/bin/ file.S
and got the following error:
icc: error #10001: could not find directory in which /path/to/binutils/bin/g++ resides
Fair enough but shouldn't it complain about gcc? I even created a symlink to g++ in that directory and still got the same error. Looks like a bug to me.
Ok, let's give icc the right path to the gcc that want to use:
icc -gcc-name=/path/to/gcc/bin/gcc -gnu-prefix=/path/to/binutils/bin/ file.S
and the error is:
/path/to/binutils/bin/cpp: No such file or directory
Looks like we can't tell icc what we want using just command line arguments. Let's try to set GCC_EXEC_PREFIX, which icc takes into account when looking for 'as' and 'ld':
icc -gcc-name=/path/to/gcc/bin/gcc file.S
It worked but I still wish icc used the cpp from /path/to/gcc/bin/ for preprocessing, but not the one it finds in the PATH. Maybe there are ways to get what I want without modifying PATH but I have not found them yet.
However, it would be really nice to be able to specify all necessary paths to applications with just command line arguments. Unfortunately, it looks like icc doesn't currently allow that.
It would also be nice if icc accounted for '--with-as' and '--with-ld' configuration flags of gcc, which hardcode the paths to 'as' and 'ld'. The better solution might be to call 'gcc - print-prog-name=as' but that would require additional calls to gcc while the configuration flags are parsed by icc anyway. On the other hand, this feature would probably introduce additional confusion sometimes.