For the past few years, GCC has allowed duplicate typedefs as long as they're compatible with each other. The issue I'm facing is with DWARF debugging extensions: it seems that GCC (v4.8) marks duplicate typedefs as unused, and does not include them in DWARF.
Example:
typedef struct yyx yyx_handle;
typedef struct yyx yyx_handle;
yyx_handle *get_yyx(void *p)
{ return (yyx_handle *)p; }
Results:
$ gcc -o f1.o -c f1.c -g
$ readelf --debug-dump f1.o | grep yyx_handle | wc -l
0
If I add -fno-eliminate-unused-debug-types
the typedef is included, but then all my unused types appear as well, blowing up the object file size.
The obvious solution is to remove the duplicate definition, but that's not always practical. Any other suggestions?
No comments:
Post a Comment