This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: Mark discarded debug info more thoroughly


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?


H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]