With the core of libhugetlbfs now supporting relinking without the need for
custom scripts, export the feature to users in an easy to use manner. For a
binary to be properly linked to support this remapping method, three things
must be added to the ld command line during the final link:
-zcommon-page-size=<slice-size>, -zmax-page-size=<slice-size>, and -lhugetlbfs.
Add a new option to ld.hugetlbfs '--hugetlbfs-align' that will add the
appropriate options to the link command line.
Signed-off-by: Adam Litke <[EMAIL PROTECTED]>
---
ld.hugetlbfs | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/ld.hugetlbfs b/ld.hugetlbfs
index 71e54bd..154d427 100755
--- a/ld.hugetlbfs
+++ b/ld.hugetlbfs
@@ -45,6 +45,9 @@ while [ -n "$1" ]; do
--hugetlbfs-script-path=*)
HUGETLB_LDSCRIPT_PATH="${arg#--hugetlbfs-script-path=}"
;;
+ --hugetlbfs-align)
+ HTLB_ALIGN="slice"
+ ;;
--)
args=("[EMAIL PROTECTED]" "$@")
break
@@ -58,8 +61,20 @@ while [ -n "$1" ]; do
done
if [ -n "$HTLB_LINK" ]; then
+ HTLB_ALIGN="" # --hugetlbfs-link overrides --hugetlbfs-align
LDSCRIPT="$EMU.x$HTLB_LINK"
HTLBOPTS="-T${HUGETLB_LDSCRIPT_PATH}/${LDSCRIPT}"
fi
+MB=$((1024*1024))
+case "$EMU" in
+elf32ppclinux|elf64ppc) HPAGE_SIZE=$((16*$MB)) SLICE_SIZE=$((256*$MB))
;;
+elf_i386|elf_x86_64) HPAGE_SIZE=$((4*$MB)) SLICE_SIZE=$HPAGE_SIZE ;;
+esac
+
+if [ "$HTLB_ALIGN" == "slice" ]; then
+ HTLBOPTS="-zcommon-page-size=$SLICE_SIZE -zmax-page-size=$SLICE_SIZE"
+ HTLBOPTS="$HTLBOPTS -lhugetlbfs"
+fi
+
${LD} "[EMAIL PROTECTED]" ${HTLBOPTS}
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Register now and save $200. Hurry, offer ends at 11:59 p.m.,
Monday, April 7! Use priority code J8TLD2.
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