Currently segment remapping on powerpc32 fails to copy the PLT section. This is because, like ppc64, the PLT is NOBITS so it is missed by the PROGBITS copy. This patch adds the elf32ppclinux.c file that defines the plt_extrasz function to compute the PLT size to ensure that it is copied. The only difference from the 64 bit version is the size of PLT[0] is 72 bytes on PPC32 as opposed to 24 bytes on PPC64.
Signed-off-by: Eric Munson <[EMAIL PROTECTED]>
---
Makefile | 3 +++
elf32ppclinux.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index e18dba7..7cef0a9 100644
--- a/Makefile
+++ b/Makefile
@@ -78,6 +78,9 @@ endif
ifdef ELF64
LIBOBJS64 = obj64/elflink.o obj64/sys-$(ELF64).o
endif
+ifeq ($(ELF32),elf32ppclinux)
+LIBOBJS32 += obj32/$(ELF32).o
+endif
ifeq ($(ELF64),elf64ppc)
LIBOBJS64 += obj64/$(ELF64).o
endif
diff --git a/elf32ppclinux.c b/elf32ppclinux.c
new file mode 100644
index 0000000..5c077ff
--- /dev/null
+++ b/elf32ppclinux.c
@@ -0,0 +1,52 @@
+/*
+ * libhugetlbfs - Easy use of Linux hugepages
+ * Copyright (C) 2008 Adam Litke, IBM Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <elf.h>
+#include <link.h>
+
+/*
+ * The powerpc 32-bit ELF ABI defines the location and size of the plt as
+ * follows (see the ELF ABI and powerpc32 supplement for details):
+ *
+ * Location: (data segment p_vaddr) + (data segment p_filesz)
+ * Size: (dynamic symbol table DT_PTRELSZ entry) + 72
+ *
+ * plt entries have likely been initialized when the libhugetlbfs remapping
+ * code runs, we must copy these entries when preparing the data segment. Tell
+ * the arch-independent code how many bytes to copy.
+ */
+ElfW(Word) plt_extrasz(ElfW(Dyn) *dyntab)
+{
+ int i;
+ ElfW(Word) pltrelsz = 0;
+
+ /* Find the needed information in the dynamic section */
+ for (i = 0; dyntab[i].d_tag != DT_NULL; i++)
+ if (dyntab[i].d_tag == DT_PLTRELSZ)
+ pltrelsz = dyntab[i].d_un.d_val;
+
+ /* pltrelsz indicates the size of all plt entries used to cache
+ * symbol lookups, but does not include the reserved entry at PLT[0].
+ * 72 bytes is the ABI-defined size of a plt entry.
+ */
+ if (pltrelsz)
+ return pltrelsz + 72;
+ else
+ return 0;
+}
signature.asc
Description: This is a digitally signed message part
------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________ Libhugetlbfs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel
