https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120571
--- Comment #2 from Ben Woodard <woodard at redhat dot com> --- Yes a partial workaround could be something like: gcc -g -fno-eliminate-unused-debug-types -include impl.h -xc /dev/null -c -o FOO.o which will emit the type and the variable but still doesn't give us the declaration coordinates of the function prototypes. (2 of the 3 things that I need) Contents of the .debug_info section: Compilation Unit @ offset 0: Length: 0x2c (32-bit) Version: 5 Unit Type: DW_UT_compile (1) Abbrev Offset: 0 Pointer Size: 8 <0><c>: Abbrev Number: 1 (DW_TAG_compile_unit) <d> DW_AT_producer : (indirect string, offset: 0xd): GNU C17 14.2.1 20250110 (Red Hat 14.2.1-7) -mtune=generic -march=x86-64-v3 -g -fno-eliminate-unused-debug-types <11> DW_AT_language : 29 (C11) <12> DW_AT_name : (indirect line string, offset: 0x17): /dev/null <16> DW_AT_comp_dir : (indirect line string, offset: 0): /home/ben/Work/abidiff <1a> DW_AT_stmt_list : 0 <1><1e>: Abbrev Number: 2 (DW_TAG_structure_type) <1f> DW_AT_name : (indirect string, offset: 0): Point <23> DW_AT_declaration : 1 <1><23>: Abbrev Number: 3 (DW_TAG_variable) <24> DW_AT_name : (indirect string, offset: 0x6): ORIGIN <28> DW_AT_decl_file : 1 <29> DW_AT_decl_line : 4 <2a> DW_AT_decl_column : 21 <2b> DW_AT_type : <0x1e> <2f> DW_AT_external : 1 <2f> DW_AT_declaration : 1 <1><2f>: Abbrev Number: 0 -fno-eliminate-unused-debug-symbols still doesn't emit the function declaration coordinates. The output is the same as above. If there was an option like: -gno-eliminate-function-prototypes Then we probably would have everything we need. I didn't see anything like that when scrolling through the -f and the -g options in the invoking GCC option index page but there are a huge number of options and I could have missed something. As for being wasteful, it certainly doesn't need to be the default. We are completely fine having this behavior turned on only under the control of a command line argument. Some suggestions are: Add -gno-eliminate-function-prototypes extending -fno-eliminate-unused-debug-symbols so that it also includes function prototypes Add -gincomplete-declarations or -gno-eliminate-incomplete-declarations (which would basically be the same as -fno-eliminate-unused-debug-types and either an extended -fno-eliminate-unused-debug-symbols or something like -gno-eliminate-function-prototypes or add it to -g3 which is users kind of understand as "give me everything you've got, I don't care how big the .debug_info" section ends up being."