This is the mail archive of the
mailing list for the binutils project.
Re: [PATCH] Fix `defined in discarded section' errors when building ia64 gcc
On Tue, Aug 17, 2004 at 12:04:29PM +0200, Jakub Jelinek wrote:
> On Tue, Aug 17, 2004 at 11:02:01AM +0200, Jakub Jelinek wrote:
> > Current gcc 3.4.x (at least gcc-3_4-rhl-branch) doesn't build with CVS
> > binutils (nor 220.127.116.11.2).
> > The problem is that libstdc++.so linking fails with:
> > `.gnu.linkonce.t._ZNSdD2Ev' referenced in section `.gnu.linkonce.ia64unw._ZNSdD2Ev' of .libs/sstream-inst.o: defined in discarded section `.gnu.linkonce.t._ZNSdD2Ev' of .libs/sstream-inst.o
> > The problem is that both io-inst.s and sstream-inst.s have
> > .gnu.linkonce.t._ZNSdD2Ev definition, but because io-inst.cc
> > also instantiates some templates sstream-inst.cc doesn't instantiate,
> > the inliner can do a better job in io-inst.cc.
> > The result is that _ZNSdD2Ev in io-inst.cc is a leaf routine, while
> > it is not in sstream-inst.cc (in assembly,
> > _ZNSdD2Ev in io-inst.s starts with .prologue and no .save directives,
> > while _ZNSdD2Ev] in sstream-inst.s has .prologue 12, 35 and some
> > .save directives.
> > IA-64 ABI allows leaf routines to have no unwind section at all,
> > which means .gnu.linkonce.ia64unw._ZNSdD2Ev is not created in
> > io-inst.o at all and as .gnu.linkonce.t._ZNSdD2Ev comes first
> > and wins, .gnu.linkonce.ia64unw._ZNSdD2Ev in sstream.o suddenly
> > references a discarded section.
> > Not sure what should be done here, but certainly the compiler
> > isn't at fault here, it is a binutils problem.
> > One fix could be to create empty .gnu.linkonce.ia64unw.* section
> > in assembler, another special case ia64 unwind sections in the linker.
> Here is a patch for the first possibility.
> It certainly makes libstdc++.so to link and even the unwind info looks
> good on brief skimming.
I am natural on this patch. But since the new assembler is used, why
not enable comdat group in gcc? I hope we can't get rid of linkonce