libhugetlbfs/0004-ld.hugetlbfs-pick-an-emulation-if-m-is-not-present.patch
2019-09-30 10:56:32 -04:00

43 lines
1.2 KiB
Diff

From a979e0b01a76f199974c76c9799b0210562147ec Mon Sep 17 00:00:00 2001
From: Jan Stancek <jstancek@redhat.com>
Date: Thu, 2 Feb 2017 11:04:08 +0100
Subject: [PATCH 17/28] ld.hugetlbfs: pick an emulation if -m is not present
If -m is not passed on command line $EMU ends up empty
and as result HPAGE_SIZE and SLICE_SIZE are left uninitialized.
Try environment variable LDEMULATION and if it's not defined
pick first from "Supported emulations" list of ld -V.
Signed-off-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Eric B Munson <emunson@mgebm.net>
---
ld.hugetlbfs | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/ld.hugetlbfs b/ld.hugetlbfs
index 32bc6fb..2dda451 100755
--- a/ld.hugetlbfs
+++ b/ld.hugetlbfs
@@ -81,6 +81,17 @@ if [ -n "$HTLB_LINK" ]; then
HTLBOPTS="-T${HUGETLB_LDSCRIPT_PATH}/${LDSCRIPT}"
fi
+# if -m is not present on command line
+if [ -z "$EMU" ]; then
+ if [ -n "$LDEMULATION" ]; then
+ # try env. variable
+ EMU="$LDEMULATION"
+ else
+ # pick first supported
+ EMU="$(ld -V | sed -n '/Supported emulations/{n;p}' | tr -d ' ')"
+ fi
+fi
+
MB=$((1024*1024))
case "$EMU" in
elf32ppclinux|elf64ppc) HPAGE_SIZE=$((16*$MB)) SLICE_SIZE=$((256*$MB)) ;;
--
1.8.3.1