[Dwarf-Discuss] DW_AT_low_pc/DW_AT_high_pc for empty compilation units
Jan Kratochvil
jan.kratochvil@redhat.com
Sun Apr 10 19:56:56 GMT 2011
Hi,
for the 'int x;' compilation unit there exists no code.
echo 'int x;' | cc -c -x c - -g; echo 'main(){}' | cc 1.o -x c -; readelf -wi a.out
->
<0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
< c> DW_AT_producer : (indirect string, offset: 0x11): GNU C 4.5.1 20100924 (Red Hat 4.5.1-4)
[...]
<19> DW_AT_low_pc : 0x400454
<21> DW_AT_high_pc : 0x400454
Should be DW_AT_low_pc == DW_AT_high_pc as is with GCC or should be both
attributes omitted at all?
Appendix A states the list of tag-attribute pairs is not binding in any way.
Some my interpretations of DWARF-4 statements can be found in:
[patch] Fix empty PC range psymtab<->symtab discrepancy
http://sourceware.org/ml/gdb-patches/2011-03/msg00739.html
There is a related issue with both attributes being 0 by the GNU toolchain for
functions discarded during linking. I guess the whole DIE(s) should have been
also discarded instead as it violates DWARF this way:
<1><12ff>: Abbrev Number: 58 (DW_TAG_subprogram)
<1300> DW_AT_external : 1
<1301> DW_AT_name : (indirect string, offset: 0x381): bus_activation_ref
[...]
<130d> DW_AT_low_pc : 0x0
<1315> DW_AT_high_pc : 0x0
[...]
Thanks,
Jan
More information about the Dwarf-discuss
mailing list