Skip to content

Commit

Permalink
ld.hugetlbfs: pick an emulation if -m is not present
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Eric B Munson <[email protected]>
  • Loading branch information
jstancek authored and khers committed Feb 16, 2017
1 parent 26c6b9b commit a979e0b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ld.hugetlbfs
Original file line number Diff line number Diff line change
Expand Up @@ -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)) ;;
Expand Down

0 comments on commit a979e0b

Please sign in to comment.