Is there a way to use __builtin___memcpy_chk() for compiler-generated memcpy calls?

Dallman, John john.dallman@siemens.com
Mon Jan 15 11:19:03 GMT 2024


Hi, folks, 

I'm trying to eliminate calls to classic string functions (strcpy, strcat, etc.) and memcpy from a shared library, built from C and C++ code with GCC 11.2. With -D_FORTIFY=2 and a bit of work with macros, I've eliminated all of them from the source, but I still have calls to memcpy from the object files. My suspected causes of these are:

a) Struct copying, with memcpy calls inserted by the compiler.
b) memcpy calls in the C++ Standard Template Library. 

Is there a way to ask GCC to use __builtin___memcpy_chk() in place of plain memcpy() for either of these?
With best regards,

-- 
John Dallman



More information about the Gcc-help mailing list