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. 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.

For instance, if I compile this with -O -S for an x86_64-linux target
int *sub (void) { static int i = 10; return &i; }
int *sub2 (void) { static int i = 20; return &i; }
I get variables i.1499 and i.1504. If I add another variable in the first line
static int y;
then I now have variables i.1500 and i.1505.

This wouldn't happen with functions unless you have nested functions.

You could see a similar problem if compiling multiple files as one unit, since static functions in different files could have the same name, which would have to be changed to make them unique. This is probably handled in a different place in the gcc code, but probably handled the same way.

Jim

Reply via email to