Allow copy relocations with pie links
Alan Modra
amodra@gmail.com
Fri May 9 01:08:00 GMT 2014
On Thu, May 08, 2014 at 04:29:20PM -0700, Cary Coutant wrote:
> >> I ran the i386 tests. David, Alan, Walt, and Doug, can you help test
> >> this patch on your respective targets?
> >
> > The change isn't appropriate for powerpc. We don't have pc-relative
> > addressing modes, so must use the GOT in PIEs.
>
> case elfcpp::R_PPC64_REL64:
> case elfcpp::R_POWERPC_REL32:
> // Make a dynamic relocation if necessary.
> if (gsym->needs_dynamic_reloc(Scan::get_reference_flags(r_type, target)))
> {
> if (gsym->may_need_copy_reloc())
> {
> target->copy_reloc(symtab, layout, object,
> data_shndx, output_section, gsym,
> reloc);
> }
>
> What should this code do, then? Add a COPY reloc only for
> position-dependent executables?
Yes. If we're building a PIE then we should be using -fpic/PIC
compiled code and won't have the relocs that would hit this code. If
we do try to build a PIE with non-PIC code, then we'll get dynamic
relocs in text. Enabling copy relocs for PIEs would still give
us DT_TEXTREL. (Of course, ppc64 gcc is PIC by default, so the
foregoing mostly applies to ppc32.)
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list