[PATCH] Emit DWARF info for all code section in an assembly file
Eric Christopher
echristo at gmail.com
Mon Apr 14 15:46:56 PDT 2014
On Thu, Apr 10, 2014 at 8:24 AM, Oliver Stannard
<oliver.stannard at arm.com> wrote:
> > You still need a DW_AT_low_pc as the offset for the for the ranges section.
>
> I don't think we need DW_AT_low_pc when the input is assembly, as it is optional in the DWARF spec and we do not emit any debug info which could use it.
>
> The two reasons to include DW_AT_low_pc as well as DW_AT_ranges are:
> * Specifying the default base address for the .debug_ranges section. We do not need this as we have a base address entry for each section in .debug_ranges, so the default never gets used.
> * Specifying the default base address for the .debug_loc section. We do not need this as we never emit the .debug_loc section for an assembly file.
>
> > What does GCC do here?
>
> GCC seems to do the same as I am doing:
> * If no sections contain code, don't emit any debug info (not even .debug_abbrev)
> * If exactly one section contains code, use low_pc and high_pc
> * Otherwise, use .debug_ranges
>
That's weird. It's strictly larger to do it this way and using an
offset of 0 is the same effect for this case and what gcc does if you
_don't_ just assemble it. (since, of course, it's actually gas making
this decision).
More comments on the patch.
-eric
More information about the llvm-commits
mailing list