I'm using gentoo and actualy I have ~94% of packages compiled with icc. I
would like to switch to hardened profile (using pic, pie - position
independent code and ssp - stack smashing protector). For that, gcc
is special patched and it use the following flags: -fPIE, -fPIC,
FORTIFY-SOURCES and -fstack-protector or -fstack-protector-all in
various combinations as needed by situation. icc support -fpic and -fpie and have an equivalent of SSP: -fp-stack-check and no equivalent of FORTIFY_SOURCES.
I need a way to tell icc when to use -fPIC and when to use -fPIE or none of these two. With gcc this can be done using specifications files (spec files) as in following examples: