http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54095
Bug #: 54095 Summary: Unnecessary static variable renaming Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: lto AssignedTo: unassig...@gcc.gnu.org ReportedBy: r...@gcc.gnu.org For example: # cat hello.c static int foo = 5; extern int bar(int *); main() { return bar(&foo); } # cc -flto -O hello.c -r -o hello.o -nostdlib # nm hello.o U bar 0000000000000000 d foo.2353.2353 0000000000000000 T main There is no other symbol foo within the partition, so there's no need to rename the static symbol within the partition. The linux kernel modversion and CRC checking is done using static symbols in the kernel for each exported symbol. Given that the exported symbols must of course be unique, the kernel programmers know that the static symbols holding the data that controls the exports must also be unique. It would be very nice to not have to adjust the modversion logic to deal with the renames that lto currently induces.