This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PR11012 powerpc64 .opd and ifunc
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sourceware dot org
- Date: Wed, 9 Dec 2009 11:54:32 +1030
- Subject: PR11012 powerpc64 .opd and ifunc
ld.so needs .opd relocs to be processed before any ifunc relocs, so
that function calls go to the relocated address. With the default
-zcombreloc that happens by virtue of .opd relocs all being
R_PPC64_RELATIVE. For -znocombreloc we need to sort the reloc
sections.
PR ld/11012
* emulparams/elf64ppc.sh (OTHER_GOT_RELOC_SECTIONS): Move .rela.opd ..
(INITIAL_RELOC_SECTIONS): .. to here. New define.
* scripttempl/elf.sc: Expand INITIAL_RELOC_SECTIONS.
Index: ld/emulparams/elf64ppc.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf64ppc.sh,v
retrieving revision 1.21
diff -u -p -r1.21 elf64ppc.sh
--- ld/emulparams/elf64ppc.sh 22 Oct 2008 05:20:44 -0000 1.21
+++ ld/emulparams/elf64ppc.sh 9 Dec 2009 00:44:05 -0000
@@ -28,9 +28,11 @@ else
.got 0 : { *(.got) }
.toc 0 : { *(.toc) }"
fi
+# Put .opd relocs first so ld.so will process them before any ifunc relocs.
+INITIAL_RELOC_SECTIONS="
+ .rela.opd ${RELOCATING-0} : { *(.rela.opd) }"
OTHER_GOT_RELOC_SECTIONS="
.rela.toc ${RELOCATING-0} : { *(.rela.toc) }
- .rela.opd ${RELOCATING-0} : { *(.rela.opd) }
.rela.branch_lt ${RELOCATING-0} : { *(.rela.branch_lt) }"
OTHER_READWRITE_SECTIONS="
.toc1 ${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { *(.toc1) }
Index: ld/scripttempl/elf.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/elf.sc,v
retrieving revision 1.97
diff -u -p -r1.97 elf.sc
--- ld/scripttempl/elf.sc 10 Oct 2009 04:34:39 -0000 1.97
+++ ld/scripttempl/elf.sc 9 Dec 2009 00:44:06 -0000
@@ -311,6 +311,7 @@ else
COMBRELOCCAT="cat > $COMBRELOC"
fi
eval $COMBRELOCCAT <<EOF
+ ${INITIAL_RELOC_SECTIONS}
.rel.init ${RELOCATING-0} : { *(.rel.init) }
.rela.init ${RELOCATING-0} : { *(.rela.init) }
.rel.text ${RELOCATING-0} : { *(.rel.text${RELOCATING+ .rel.text.* .rel.gnu.linkonce.t.*}) }
--
Alan Modra
Australia Development Lab, IBM