What is isra in a core thread dump

A dump of the Linux kernel kernel stack often includes function names that end with ".isra.NNN", where NNN are some numbers. For example, see here and here .

What does this mean, what does a number mean?

+8
linux-kernel
source share
1 answer

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

From the gcc manual :

 -fipa-sra 

Performing interprocedural scalar replacement of aggregates, deleting unused parameters and replacing parameters transferred by reference by parameter by value.

Enabled at -O2 , -O3 and -Os .

All functions optimized for this option have isra added to their names. I dug out gcc code and found a function adding a line.

 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); } 

Here is argument 2, const char *suffix , "isra" and notice at the bottom of the macro the function ASM_FORMAT_PRIVATE_NAME , which takes clone_fn_id_num++ as its third argument. This is an arbitrary number found after "isra" . This happens by its name - this is the number of functions that are cloned under this compiler option (or it can be a global counter that tracks all cloned functions).

If you want to learn more, search for modify_function in the gcc/tree-sra.c , which in turn calls cgraph_function_versioning() , which passes "isra" as the last argument.

+18
source share

All Articles