Quantcast
Channel: Intel® C++-Compiler
Viewing all articles
Browse latest Browse all 1665

__stack_chk_guard and -fstack-protector-strong

$
0
0

I am building some sources on CentOS 6 with the following command 

/opt/intel/composer_xe_2016.2.181/bin/intel64/icc -o stream.o -c -Wall -Wformat -Wformat-security -Wparentheses -fstack-protector-strong -g -O0 -gcc-name=/opt/gcc-4.9.1/bin/gcc -gxx-name=/opt/gcc-4.9.1/bin/g++ -O3 -openmp -DSTREAM_ARRAY_SIZE=64000000 -opt-prefetch-distance=64,8 -opt-streaming-cache-evict=0 -opt-streaming-stores always -axMIC-AVX512 -DDEBUG -D_FORTIFY_SOURCE=2 /stream/src/stream.c -fPIE

CentOS 6 ships with GCC 4.4.7 by default, we need C++11 support, so we have installed gcc-4.9.1 in /opt/gcc-4.9.1 

When I look up symbols in stream.o with "nm", I see a __stack_chk_guard symbol in some machines, and the symbol is missing from the object file built on other machines.

The ICC version and GCC-4.9.1 are completely identical.

What in the machine environment could be producing the difference where an object file built in one machine has __stack_chk_guard and the object file built on another does not?

When the __stack_chk_guard is not found in the symbols, I am able to build the binary by simply executing - 

/opt/intel/composer_xe_2016.2.181/bin/intel64/icc -o stream -static-intel -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro stream.o  -liomp5 -pie

However, if the __stack_chk_guard is indeed present, I am now forced to add a "-L/opt/gcc-4.9.1/lib64 -lssp" or I get "Undefined reference to __stack_chk_guard" errors all over the place.

 


Viewing all articles
Browse latest Browse all 1665

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>