[cfe-users] Stack protection with clang

Alex Chen via cfe-users cfe-users at lists.llvm.org
Thu Sep 20 13:25:01 PDT 2018


I am using clang compiler 4.0.1 on CentOS 7.4 with gcc 4.8.5.  I get the ready-made compiler from CentOS development repository and the resulting binaries use libstdc++ runtime library from GNU not libc++, which is not present in clang RPM I get anyway.
I want to turn on stack projection but do not know which compiler flag I should use.   As far as I know clang uses the '-fsanitize=safe-stack' flag while gcc has various flags '-fstack-check',  '-fstack-protector', '-fstack-protector-all', '-fstack-protector-strong', etc.
Currently we use the -fstack-protector-strong flag but I do not know if this flag is recognized/honored by clang.  I remember I use -fsanitize=safe-stack flag once but I get resolved symbol errors.  It seems that flag requires the binaries be linked with libc++ instead of libstdc++ from GNU.

Any help is appreciated.

Alex 
 
 





More information about the cfe-users mailing list