-fstack-protector and STL string
Martin Richtarsky
s@martinien.de
Thu Mar 24 11:32:00 GMT 2016
Hi all,
we are using the -fstack-protector compiler option with gcc 5.x to detect
stack smashing. While analyzing a performance regression resulting from
this I found the instrumentation is also done for our STL string
implementation which has an interned buffer for short strings. So
basically a function having an object of that string class on the stack
would incur some performance overhead due to checking, although it can be
argued that the string class is pretty safe.
Is there a way of excluding either a class or a class member from
triggering the instrumentation?
I have noticed that switching to wchar_t (e.g. unsigned short on x86)
already removes the checking, which means that STL wstring is not checked.
However, there is no 1 byte type I could use for string which avoids the
checking.
Any ideas?
Thanks and best regards,
Martin
More information about the Gcc-help
mailing list