linux-kernel – 内核线程转储中的“isra”是什么

前端之家收集整理的这篇文章主要介绍了linux-kernel – 内核线程转储中的“isra”是什么前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
Linux内核调用堆栈转储通常包括以“.isra.NNN”结尾的函数名,其中NNN是某些数字.例如,请参阅 herehere.

这意味着什么,这个数字意味着什么?

解决方法

isra is the suffix added to the function name when gcc option -fipa-sra compiler optimization being carried out.

gcc manual开始:

  1. -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代码并找到了附加字符串的函数.

  1. tree
  2. clone_function_name (tree decl,const char *suffix)
  3. {
  4. tree name = DECL_ASSEMBLER_NAME (decl);
  5. size_t len = IDENTIFIER_LENGTH (name);
  6. char *tmp_name,*prefix;
  7.  
  8. prefix = XALLOCAVEC (char,len + strlen (suffix) + 2);
  9. memcpy (prefix,IDENTIFIER_POINTER (name),len);
  10. strcpy (prefix + len + 1,suffix);
  11. #ifndef NO_DOT_IN_LABEL
  12. prefix[len] = '.';
  13. #elif !defined NO_DOLLAR_IN_LABEL
  14. prefix[len] = '$';
  15. #else
  16. prefix[len] = '_';
  17. #endif
  18. ASM_FORMAT_PRIVATE_NAME (tmp_name,prefix,clone_fn_id_num++);
  19. return get_identifier (tmp_name);
  20. }

这里,参数2,const char *后缀是“isra”,并注意函数宏ASM_FORMAT_PRIVATE_NAME的底部,它将clone_fn_id_num作为其第三个参数.这是在“isra”之后找到的任意数字.其名称是在此编译器选项下克隆的函数计数(或者可以是跟踪所有克隆函数的全局计数器).

如果你想了解更多,请在文件gcc / tree-sra.c中搜索modify_function,然后调用cgraph_function_versioning(),它将“isra”作为最后一个参数.

猜你在找的Linux相关文章