Re: Nested function - Avoid it in symbol table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 16/06/12 22:03, Sam wrote:
> Hi,
>
> Is there any way to disable emitting nested function names in symbol table?
> I tried visibility(hidden) attribute and it is not working.
> The problem I have is I use nested function in a macro and which
> results in embedded in multiple places causing lot of unwanted entries
> symbol table increasing this of image.
>
> Sample program:
> $ cat test.c
> #include <stdio.h>
> int main()
> {
>     __attribute__((visibility ("hidden")))
>     int nested_function()
>     {
>         printf("Hello world\n");
>     }
>     nested_function();
>     return 0;
> }
>
> $ readelf -s ./a.out | grep nest
>     50: 00000000004004a4    16 FUNC    LOCAL  DEFAULT   12 nested_function.2069
>
> Thanks
> Samuel
It disappears for me when using -O1 or higher, but that's probably due
to inlining because it's a trivial function. Still, if it isn't by
default, forcing it to inline could be an approach.
Another way would be of course to convert it to a normal function. That
will depend on the kind of magic that it's being done by that macro.

Regards



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux