加入收藏 | 设为首页 | 会员中心 | 我要投稿 商洛站长网 (https://www.0914zz.com/)- AI应用、CDN、边缘计算、云计算、物联网!
当前位置: 首页 > 综合聚焦 > Linux > 正文

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

发布时间:2021-01-11 18:18:23 所属栏目:Linux 来源:互联网
导读:Linux内核调用堆栈转储通常包括以“.isra.NNN”结尾的函数名,其中NNN是某些数字.例如,请参阅 here和 here. 这意味着什么,这个数字意味着什么? isra is the suffix added to the function name when gcc option -fipa-sra compiler optimization being carrie

Linux内核调用堆栈转储通常包括以“.isra.NNN”结尾的函数名,其中NNN是某些数字.例如,请参阅 here和 here.

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

解决方法

isra is the suffix added to the function name when gcc 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”作为最后一个参数.

(编辑:商洛站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读