解决方法
isra
is the suffix added to the function name whengcc
option-fipa-sra
compiler optimization being carried out.
从gcc manual开始:
-fipa-sra
Perform interprocedural scalar replacement of aggregates,removal of unused
parameters and replacement of parameters passed by reference by parameters passed
by value.Enabled at levels
-O2
,-O3
and-Os
.
在此选项下优化的所有函数都会在其名称后附加isra.我深入研究了gcc代码并找到了附加字符串的函数.
tree clone_function_name (tree decl,const char *suffix) { tree name = DECL_ASSEMBLER_NAME (decl); size_t len = IDENTIFIER_LENGTH (name); char *tmp_name,*prefix; prefix = XALLOCAVEC (char,len + strlen (suffix) + 2); memcpy (prefix,IDENTIFIER_POINTER (name),len); strcpy (prefix + len + 1,suffix); #ifndef NO_DOT_IN_LABEL prefix[len] = '.'; #elif !defined NO_DOLLAR_IN_LABEL prefix[len] = '$'; #else prefix[len] = '_'; #endif ASM_FORMAT_PRIVATE_NAME (tmp_name,prefix,clone_fn_id_num++); return get_identifier (tmp_name); }
这里,参数2,const char *后缀是“isra”,并注意函数宏ASM_FORMAT_PRIVATE_NAME的底部,它将clone_fn_id_num作为其第三个参数.这是在“isra”之后找到的任意数字.其名称是在此编译器选项下克隆的函数计数(或者可以是跟踪所有克隆函数的全局计数器).
如果你想了解更多,请在文件gcc / tree-sra.c中搜索modify_function,然后调用cgraph_function_versioning(),它将“isra”作为最后一个参数.