[PATCH] D40950: [ELF] - Fail when multiple .debug_* sections are used in a single object.

Robinson, Paul via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 12 10:13:48 PST 2017



> -----Original Message-----
> From: llvm-commits [mailto:llvm-commits-bounces at lists.llvm.org] On Behalf
> Of Peter Smith via llvm-commits
> Sent: Tuesday, December 12, 2017 9:14 AM
> To: jh7370.2008 at my.bristol.ac.uk
> Cc: George Rimar; llvm-commits at lists.llvm.org;
> reviews+D40950+public+2918a10317de6d24 at reviews.llvm.org
> Subject: Re: [PATCH] D40950: [ELF] - Fail when multiple .debug_* sections
> are used in a single object.
> 
> On 11 December 2017 at 15:14, James Henderson via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
> > Hi,
> >
> > My colleagues and I have actually been doing quite a bit of
> investigation in
> > the past couple of weeks into what to do about debug data that refers to
> > sections that are discarded due to --gc-sections etc. Currently, LLD
> treats
> > the references as address zero, but at least on our platform, address
> zero
> > is a valid address, so we were looking at alternatives.
> 
> Just in case this is of any use for the problem of discarded debug
> sections.
> 
> Embedded systems also frequently have valid addresses at 0 so our
> embedded toolchain encountered this problem from time to time. The
> linker had a custom garbage collection algorithm that cleaned up most
> of the debug sections associated with garbage collected sections. It
> wasn't always possible to get rid of all of them as the compiler could
> sometimes output a single .debug_info section that described more than
> one .text section. Our solution for the remaining references was to
> set the DW_AT_low_pc and DW_AT_high_pc to the same value (usually 0).
> As this gave a zero size range of addresses the debugger could
> recognise and ignore it.

That is easy when DW_AT_high_pc is also a relocatable address.  However
it is now officially sanctioned for DW_AT_high_pc to be a constant length
rather than an address; in order to achieve this effect, the linker would
have to parse the DWARF and replace the constant value with 0.

I think we're all better off if the linker picks the maximum address value
rather than the minimum address value for fixups to code that no longer
exists in the linked object file.
--paulr

> 
> Peter
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list