This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [GOLD] override get_comdat_behavior
On Wed, Oct 17, 2012 at 11:33:55AM -0700, Ian Lance Taylor wrote:
> On Wed, Oct 17, 2012 at 8:02 AM, Alan Modra <amodra@gmail.com> wrote:
> > Powerpc use of .got2 section in -fPIC code can lead to "relocation
> > refers to discarded section" warnings in testcases like gcc's
> > g++.old-deja/g++.other/comdat5.C when comdat group sections for a
> > function are dropped but not the function's .got2 entries. This type
> > of problem shows up in other sections shared between functions on
> > powerpc64, eg. .opd and .toc. Fixed by suppressing the warning the
> > same way bfd ld does. OK to apply?
> >
> > * target-reloc.h (relocate_section): Call get_comdat_behavior
> > from class Relocate.
> > * arm.cc (Relocate::get_comdat_behavior): New.
> > * i386.cc (Relocate::get_comdat_behavior): New.
> > * sparc.cc (Relocate::get_comdat_behavior): New.
> > * tilegx.cc (Relocate::get_comdat_behavior): New.
> > * x86_64.cc (Relocate::get_comdat_behavior): New.
> > * powerpc.cc (Relocate::get_comdat_behavior): New.
> > (Target_powerpc::relocate_section): Don't zap opd relocs.
>
>
> You can implement this without requiring every target to have a
> trivial get_comdat_behavior method. Add a new template parameter to
> relocate_section in target-reloc.h. Give it a default value.
>
> template<..., typename Relocate_comdat_behaviour = Default_comdat_behavior>
> inline void
> Relocate_section(...)
I thought about doing that but
error: default template arguments may not be used in function templates without -std=c++0x or -std=gnu++
--
Alan Modra
Australia Development Lab, IBM