[libhugetlbfs] Add Patch to support building on ppc64le
Eric Munson
emunson at fedoraproject.org
Sun Mar 16 01:56:51 UTC 2014
commit e873a28314290c6afa39ccad88c9e2bd253bf9ef
Author: Eric Munson <emunson at bert.mgebm.net>
Date: Sat Mar 15 21:56:49 2014 -0400
Add Patch to support building on ppc64le
libhugetlbfs-2.17-ppc64le.patch | 300 +++++++++++++++++++++++++++++++++++++++
libhugetlbfs.spec | 6 +-
2 files changed, 305 insertions(+), 1 deletions(-)
---
diff --git a/libhugetlbfs-2.17-ppc64le.patch b/libhugetlbfs-2.17-ppc64le.patch
new file mode 100644
index 0000000..f943861
--- /dev/null
+++ b/libhugetlbfs-2.17-ppc64le.patch
@@ -0,0 +1,300 @@
+From 1594705e64cbe51e0f0b6c5ebcad6adf230e6e35 Mon Sep 17 00:00:00 2001
+From: Michel Normand <normand at linux.vnet.ibm.com>
+Date: Fri, 14 Mar 2014 04:51:35 -0500
+Subject: [PATCH] libhugetlbfs add ppc64le support
+
+related code change already available in libhugetlbfs upstream
+after tag 2.17 (there is not yet new 2.18 tag)
+
+Signed-off-by: Michel Normand <normand at linux.vnet.ibm.com>
+
+diff --git a/libhugetlbfs.ppc64le.patch b/libhugetlbfs.ppc64le.patch
+new file mode 100644
+index 0000000..f472074
+--- /dev/null
++++ b/libhugetlbfs.ppc64le.patch
+@@ -0,0 +1,42 @@
++Add ppc64le support
++
++Signed-off-by: Anton Blanchard <anton at samba.org>
++---
++
++Index: libhugetlbfs-2.17/Makefile
++===================================================================
++--- libhugetlbfs-2.17.orig/Makefile
+++++ libhugetlbfs-2.17/Makefile
++@@ -47,6 +47,11 @@ CC32 = $(CC) -m32
++ ELF32 = elf32ppclinux
++ endif
++ else
+++ifeq ($(ARCH),powerpc64le)
+++CC64 = gcc -m64
+++ELF64 = elf64lppc
+++TMPLIB64 = lib64
+++else
++ ifeq ($(ARCH),powerpc)
++ CC32 = $(CC) -m32
++ ELF32 = elf32ppclinux
++@@ -110,6 +115,7 @@ $(error "Unrecognized architecture ($(AR
++ endif
++ endif
++ endif
+++endif
++ endif
++ endif
++ endif
++Index: libhugetlbfs-2.17/contrib/tlbmiss_cost.sh
++===================================================================
++--- libhugetlbfs-2.17.orig/contrib/tlbmiss_cost.sh
+++++ libhugetlbfs-2.17/contrib/tlbmiss_cost.sh
++@@ -44,7 +44,7 @@ cpumhz() {
++ FNAME="cpu MHz"
++ FINDEX=4
++ case "`uname -m`" in
++- ppc64)
+++ ppc64|ppc64le)
++ FNAME="clock"
++ FINDEX=3
++ ;;
+diff --git a/libhugetlbfs.ppc64le.step2.patch b/libhugetlbfs.ppc64le.step2.patch
+new file mode 100644
+index 0000000..5115680
+--- /dev/null
++++ b/libhugetlbfs.ppc64le.step2.patch
+@@ -0,0 +1,70 @@
++Subject: libhugetlbfs.ppc64le.step2
++From: Michel Normand <normand at linux.vnet.ibm.com>
++
++Need to create the elf64lppc.c supposed to be a soft link of elf64ppc.c
++But do not know hwo to do that via a patch <= TODO
++
++Signed-off-by: Michel Normand <normand at linux.vnet.ibm.com>
++---
++ elf64lppc.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
++ 1 file changed, 54 insertions(+)
++
++Index: libhugetlbfs-2.16/elf64lppc.c
++===================================================================
++--- /dev/null
+++++ libhugetlbfs-2.16/elf64lppc.c
++@@ -0,0 +1,54 @@
+++/*
+++ * 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>
+++
+++#include "libhugetlbfs_internal.h"
+++
+++/*
+++ * The powerpc 64-bit ELF ABI defines the location and size of the plt as
+++ * follows (see the ELF ABI and powerpc64 supplement for details):
+++ *
+++ * Location: (data segment p_vaddr) + (data segment p_filesz)
+++ * Size: (dynamic symbol table DT_PTRELSZ entry) + 24
+++ *
+++ * 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].
+++ * 24 bytes is the ABI-defined size of a plt entry.
+++ */
+++ if (pltrelsz)
+++ return pltrelsz + 24;
+++ else
+++ return 0;
+++}
+diff --git a/libhugetlbfs.ppc64le.step3.patch b/libhugetlbfs.ppc64le.step3.patch
+new file mode 100644
+index 0000000..4ae470d
+--- /dev/null
++++ b/libhugetlbfs.ppc64le.step3.patch
+@@ -0,0 +1,91 @@
++Subject: libhugetlbfs ppc64le step3
++From: Michel Normand <normand at linux.vnet.ibm.com>
++
++sys-elf64ppc.S updated to support PowerPC ABI V2
++and create a soft link as sys-elf64lppc.S
++TODO: I do not know how to create a soft link via patch
++
++Signed-off-by: Michel Normand <normand at linux.vnet.ibm.com>
++---
++ sys-elf64lppc.S | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
++ sys-elf64ppc.S | 7 ++++++-
++ 2 files changed, 54 insertions(+), 1 deletion(-)
++
++Index: libhugetlbfs-2.16/sys-elf64ppc.S
++===================================================================
++--- libhugetlbfs-2.16.orig/sys-elf64ppc.S
+++++ libhugetlbfs-2.16/sys-elf64ppc.S
++@@ -20,7 +20,7 @@
++ */
++
++ .text
++-
+++#if _CALL_ELF != 2
++ .align 2
++ .globl direct_syscall
++ .globl .direct_syscall
++@@ -32,6 +32,11 @@ direct_syscall:
++ .previous
++ .type .direct_syscall, at function
++ .direct_syscall:
+++#else
+++ .globl direct_syscall
+++ .type direct_syscall, at function
+++direct_syscall:
+++#endif
++ mr 0,3
++ mr 3,4
++ mr 4,5
++Index: libhugetlbfs-2.16/sys-elf64lppc.S
++===================================================================
++--- /dev/null
+++++ libhugetlbfs-2.16/sys-elf64lppc.S
++@@ -0,0 +1,48 @@
+++/*
+++ * libhugetlbfs - Easy use of Linux hugepages
+++ * Copyright (C) 2007 David Gibson, IBM Corporation.
+++ *
+++ * Based on code from the GNU C Library, Copyright Free Software Foundation, Inc.
+++ *
+++ * 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
+++ */
+++
+++ .text
+++#if _CALL_ELF != 2
+++ .align 2
+++ .globl direct_syscall
+++ .globl .direct_syscall
+++ .section ".opd","aw"
+++direct_syscall:
+++ .quad .direct_syscall
+++ .quad .TOC. at tocbase
+++ .quad 0
+++ .previous
+++ .type .direct_syscall, at function
+++.direct_syscall:
+++#else
+++ .globl direct_syscall
+++ .type direct_syscall, at function
+++direct_syscall:
+++#endif
+++ mr 0,3
+++ mr 3,4
+++ mr 4,5
+++ mr 5,6
+++ mr 6,7
+++ mr 7,8
+++ mr 8,9
+++ sc
+++ blr
+diff --git a/libhugetlbfs.ppc64le.step4.patch b/libhugetlbfs.ppc64le.step4.patch
+new file mode 100644
+index 0000000..4e2f722
+--- /dev/null
++++ b/libhugetlbfs.ppc64le.step4.patch
+@@ -0,0 +1,37 @@
++Subject: libhugetlbfs.ppc64le.step4
++From: Michel Normand <normand at linux.vnet.ibm.com>
++
++ppc64le support (step4) Add --hugetlbfs-align
++
++use this existing new method rather than the deprecated linker-script.
++
++Signed-off-by: Michel Normand <normand at linux.vnet.ibm.com>
++---
++ Makefile | 1 +
++ ld.hugetlbfs | 1 +
++ 2 files changed, 2 insertions(+)
++
++Index: libhugetlbfs-2.17/Makefile
++===================================================================
++--- libhugetlbfs-2.17.orig/Makefile
+++++ libhugetlbfs-2.17/Makefile
++@@ -51,6 +51,7 @@ ifeq ($(ARCH),ppc64le)
++ CC64 = gcc -m64
++ ELF64 = elf64lppc
++ TMPLIB64 = lib64
+++CUSTOM_LDSCRIPTS = no
++ else
++ ifeq ($(ARCH),powerpc)
++ CC32 = $(CC) -m32
++Index: libhugetlbfs-2.17/ld.hugetlbfs
++===================================================================
++--- libhugetlbfs-2.17.orig/ld.hugetlbfs
+++++ libhugetlbfs-2.17/ld.hugetlbfs
++@@ -84,6 +84,7 @@ fi
++ MB=$((1024*1024))
++ case "$EMU" in
++ elf32ppclinux|elf64ppc) HPAGE_SIZE=$((16*$MB)) SLICE_SIZE=$((256*$MB)) ;;
+++elf64lppc) HPAGE_SIZE=$((16*$MB)) SLICE_SIZE=$((256*$MB)) ;;
++ elf_i386|elf_x86_64) HPAGE_SIZE=$((4*$MB)) SLICE_SIZE=$HPAGE_SIZE ;;
++ elf_s390|elf64_s390) HPAGE_SIZE=$((1*$MB)) SLICE_SIZE=$HPAGE_SIZE ;;
++ armelf_linux_eabi|aarch64elf) HPAGE_SIZE=$((2*MB)) SLICE_SIZE=$HPAGE_SIZE ;;
+diff --git a/libhugetlbfs.spec b/libhugetlbfs.spec
+index ee543b5..bee4f4b 100644
+--- a/libhugetlbfs.spec
++++ b/libhugetlbfs.spec
+@@ -9,6 +9,10 @@ URL: http://libhugetlbfs.sourceforge.net/
+ Source0: http://downloads.sourceforge.net/libhugetlbfs/%{name}-%{version}.tar.gz
+ Patch0: libhugetlbfs-2.17-s390.patch
+ Patch1: libhugetlbfs-2.17-ppc.patch
++Patch2: libhugetlbfs.ppc64le.patch
++Patch3: libhugetlbfs.ppc64le.step2.patch
++Patch4: libhugetlbfs.ppc64le.step3.patch
++Patch5: libhugetlbfs.ppc64le.step4.patch
+
+ BuildRequires: glibc-devel
+ BuildRequires: glibc-static
+@@ -44,6 +48,10 @@ pool size control. pagesize lists page sizes available on the machine.
+ %setup -q -n %{name}-%{version}
+ %patch0 -p1 -b .s390
+ %patch1 -p1 -b .ppc
++%patch2 -p1
++%patch3 -p1
++%patch4 -p1
++%patch5 -p1
+
+ %build
+ # Parallel builds are not reliable
diff --git a/libhugetlbfs.spec b/libhugetlbfs.spec
index ee543b5..4a86bfb 100644
--- a/libhugetlbfs.spec
+++ b/libhugetlbfs.spec
@@ -1,6 +1,6 @@
Name: libhugetlbfs
Version: 2.17
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: A library which provides easy access to huge pages of memory
Group: System Environment/Libraries
@@ -9,6 +9,7 @@ URL: http://libhugetlbfs.sourceforge.net/
Source0: http://downloads.sourceforge.net/libhugetlbfs/%{name}-%{version}.tar.gz
Patch0: libhugetlbfs-2.17-s390.patch
Patch1: libhugetlbfs-2.17-ppc.patch
+Patch2: libhugetlbfs-2.17-ppc64le.patch
BuildRequires: glibc-devel
BuildRequires: glibc-static
@@ -105,6 +106,9 @@ rm -fr $RPM_BUILD_ROOT/%{_sbindir}/
%exclude %{_libdir}/perl5/TLBC
%changelog
+* Sat Mar 15 2014 Eric B Munson <emunson at mgebm.net> - 2.12-2
+- Add Patch to support building on ppc64le
+
* Wed Jan 29 2014 Kyle McMartin <kyle at fedoraproject.org> - 2.17-1
- Update for upstream 2.17 release (adds AArch64 support)
- update libhugetlbfs-2.16-s390.patch for 2.17 changes to Makefile
More information about the scm-commits
mailing list