This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: understanding __FUNCTION__ generation
Hi Jim,
On 9/12/07, Jim Wilson <wilson@specifix.com> wrote:
> Sunzir Deepur wrote:
> > recently I've encountered a problem in which some removals of
> > (what seems to be unneeded) lines of header files inflicted changes in
> > the resulting binary. further inverstigation showed
> > that the chages were different __FUNCTION__.numbers (in the __FUNCTION__.
> > xxx symbol names).
>
> This would be clearer if you gave an example.
This is the diff between the old and the new binaries examined
under objdump -d -t :
2c2
< old.o: file format elf32-i386
---
> new.o: file format elf32-i386
10c10
< 00000000 l O .rodata 0000000f __FUNCTION__.4883
---
> 00000000 l O .rodata 0000000f __FUNCTION__.4848
12c12
< 0000005a l O .rodata 00000010 __FUNCTION__.4921
---
> 0000005a l O .rodata 00000010 __FUNCTION__.4886
17c17
< 000000d8 l O .rodata 00000015 __FUNCTION__.4965
---
> 000000d8 l O .rodata 00000015 __FUNCTION__.4930
20c20
< 00000119 l O .rodata 0000000e __FUNCTION__.5002
---
> 00000119 l O .rodata 0000000e __FUNCTION__.4967
22c22
< 000001a8 l O .rodata 0000000e __FUNCTION__.5022
---
> 000001a8 l O .rodata 0000000e __FUNCTION__.4987
24c24
< 0000021b l O .rodata 00000010 __FUNCTION__.5051
---
> 0000021b l O .rodata 00000010 __FUNCTION__.5016
> However, I'm guessing
> that the issue here is the names for function local statics. The names
> for these are unique within a function, but not unique across a file.
> The assembler requires unique names for them, so we add the DECL_UID to
> make them unique. See lhd_set_decl_assembler_name in langhooks.c. The
> DECL_UID changes if you add/delete declarations.
Yes ! That is it ! Thanks so much ! I use the __FUNCTION__ macro
in my code, and i guess it is translated into a static variable holding
the function name, which perfectly fits your explanation !
Thanks!!
Sunzir