One issue here is that this particular usage of DW_AT_ranges is dwarf 3,
and gas emits 2 for the dwarf version number. Don't know the right thing
to do there. Bumping the version number for this seems extreme.
Hmm, have you tried bumping the version number and seeing how it affects
GDB ? I am thinking that maybe it is the right thing to do, although it
may be necessary to add another GAS command line switch to disable the
generation of DWARF3 specific debug info for environments with debuggers
that cannot handle it.
Sterling is actually correct; you shouldn't bump the version number for
this. Every major revision of the DWARF standard which includes a
version number bump also includes some incompatible format changes
(i.e. a situation where you need to know which version it is, in order
to parse it correctly). From .debug_info version 2 to .debug_info
version 3 there were only tiny changes; one was the size of an address
versus the size indicated in the dwarf header, and another was the use
of a LEB128 versus a byte.
If you are only adding new attributes or tags from dwarf3, version 2
consumers will generally handle it correctly.