From a979e0b01a76f199974c76c9799b0210562147ec Mon Sep 17 00:00:00 2001 From: Jan Stancek Date: Thu, 2 Feb 2017 11:04:08 +0100 Subject: [PATCH] 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 Signed-off-by: Eric B Munson --- 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)) ;;