This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Relocation against discarded sections
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Evandro Menezes <evandro at yahoo dot com>
- Cc: binutils at sourceware dot org
- Date: Wed, 17 Dec 2008 21:49:22 +0100
- Subject: Re: Relocation against discarded sections
- References: <983070.12507.qm@web110601.mail.gq1.yahoo.com>
On Wed, 17 Dec 2008 21:16:17 +0100, Evandro Menezes wrote:
> There's code to handle relocations against symbols in discarded sections in
> elflink.c. But firstly why do they happen at all?
Some sections may get discarded - for example inlined functions of C++ classes
"classA.h":
class A
{
public:
A (int a) { f (); };
};
A::A() needs to be defined only once but such function is present in each .o
file. Therefore during linking only one such instance is left and other
instances are discarded.
This is being currently done through COMDAT groups, it were .gnu.linkonce.*
sections before.
And some sections can be referencing these link-once sections, such as
.eh_frame containing exceptions unwinding information for these inlined
functions. If the function itself is removed the entries for it in the
.eh_frame section are no longer needed. Therefore these entries must be
safely nullified by removing the relocations _to_ the discarded section.
If anyone (Alan Modra?) would be so kind to approve my last version of:
Re: [patch] Restore .gnu.linkonce.r. g++-3.4 linking
http://sourceware.org/ml/binutils/2008-11/msg00195.html
followup on: http://sourceware.org/ml/binutils/2008-10/threads.html#00200
Thanks,
Jan