This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: static functions appearing in the symbol table
- From: Martin Sebor <msebor at gmail dot com>
- To: Martin Faltesek <martin dot faltesek at gmail dot com>, gcc-help at gcc dot gnu dot org
- Date: Sun, 23 Aug 2015 14:36:34 -0600
- Subject: Re: static functions appearing in the symbol table
- Authentication-results: sourceware.org; auth=none
- References: <CADvosSgNoJsa6Qh6P1pmwgxmSSw5AkXwhJn3bwi3yVX3n=GqTw at mail dot gmail dot com>
On 08/23/2015 07:15 AM, Martin Faltesek wrote:
While using gcc, I've noticed that some static functions appear in the
symbol table while others do not. What are the conditions that control
when a static function's symbol appears? I would have thought all
statics would not be included.
At a high level, a static function whose calls in a program are all
inlined will not have an entry in the symbol table. A static function
that's not completely inlined will. What is and isn't inlined depends
on optimizations in effect and on attributes (e.g., function with the
always_inline attribute will likely not a have a symbol even at -O0,
while a trivial static function that's declared with attribute
noinline will even at -O1 and higher).
Martin