This is the mail archive of the
mailing list for the binutils project.
Re: RFC: Mark discarded debug info more thoroughly
- From: "H. J. Lu" <hjl at lucon dot org>
- To: binutils at sourceware dot org
- Date: Wed, 25 Oct 2006 11:37:01 -0700
- Subject: Re: RFC: Mark discarded debug info more thoroughly
- References: <20061025174848.GA25735@nevyn.them.org>
On Wed, Oct 25, 2006 at 01:48:48PM -0400, Daniel Jacobowitz wrote:
> GDB has a hack, recently improved, which lets it ignore debug
> information that appears to start at address zero. This is to match
> GNU LD's behavior for debug info referring to discarded sections,
> especially .gnu.linkonce.t.*. But it's also used for COMDAT (since
> GCC still doesn't generate COMDAT debug info), and for things dumped
> due to /DISCARD/ in a linker script.
> The hack works much better for linkonce than it does for /DISCARD/.
> For example, a customer once reported that it didn't work right for
> the Linux kernel, which uses /DISCARD/ to get rid of all .text.exit
> sections for modules compiled in to the kernel (and thus never
> unloaded). If a file has two functions in .text.exit, and uses REL
> relocations, one of them will appear to start at a low address just
> after the end of the previous function. Not at zero.
> I had some patches which extended the GDB hack. But when I was getting
> ready to submit them I had a bright idea: we can fix this in the linker
> fairly reliably. Instead of just skipping such relocations, we should
> apply them with the magic relocation value needed to put an actual
> zero in the output file. This makes final output files more consistent
> between REL and RELA targets.
> It looks like the attached. OK? If so, I will go through and try to
> fix all the other ELF architectures which support REL.
Can you add some testcases to make sure that linker does what you
want and stay that way in the future?