Reputation: 9180
Is there a way to obtain a list of functions that were NOT inlined anywhere? Either by passing an option to gcc or by inspecting the binary?
EDIT: I know how to explicitly ask for a function not to be inlined by using gcc's builtin attribute noinline.
Upvotes: 9
Views: 1584
Reputation: 70126
Add -fdump-ipa-inline
to your compiler options.
Grep the file yoursourcefile.inline
which is created next to the object file for "Considering inline candidate" to find out all functions that the compiler considered inlining.
Grep the file for "Inlined into" to find out all functions that the compiler finally did inline.
Grep for "inline_failed:" if you are interested for the reason why the compiler turned down a candidate (e.g. "call is unlikely and code size would grow").
Upvotes: 7
Reputation: 5275
'inline' is NOT an attribute of a function, a function can be both inlined and non-inlined. when you call a function, the compiler decide whether inline it or not, if there are multiple calls, the compiler may choose different option for different call. if there is at least one non-inlined call, the function will be appear in the symbol table. and if it is exported it will also appear in the symbol table.
so there is no way to check a function is inlined or not, you can only check a specific call is inlined or not by reverse engineer.
Upvotes: 0
Reputation: 206518
You can use nm command in Unix/Linux to get list of symbols in a binary.
If the function is not inlined its symbol name will be present in the binary.
Upvotes: 0