summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2017-05-13 10:56:35 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2017-05-15 16:13:45 +0200
commit62d054f6099f35ae933da102991d51dec3a197a6 (patch)
treea814115be3eb7dacb32955051e72dab252625f00 /config
parent6a1c031bc9f35c282e56dcd34dc6a9f87c6836cf (diff)
downloadptxdist-62d054f6099f35ae933da102991d51dec3a197a6.tar.gz
ptxdist-62d054f6099f35ae933da102991d51dec3a197a6.tar.xz
host-qemu: qemu-cross: make sure the linker does not read /etc/ld.so.cache
By default the target linker will read /etc/ld.so.cache of the build host. This causes qemu-ppc to crash on a x86_64 host. Avoid this by explicitly calling the dynamic linker with '--inhibit-cache'. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'config')
-rwxr-xr-xconfig/qemu/qemu-cross45
1 files changed, 45 insertions, 0 deletions
diff --git a/config/qemu/qemu-cross b/config/qemu/qemu-cross
new file mode 100755
index 000000000..221bd5f36
--- /dev/null
+++ b/config/qemu/qemu-cross
@@ -0,0 +1,45 @@
+#!/bin/bash
+#
+# Copyright (C) 2017 by Michael Olbrich <m.olbrich@pengutronix.de>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+args=(
+ "@QEMU@" \
+ -r "@KERNEL_VERSION@" \
+ -L "@QEMU_LD_PREFIX@" \
+ -E LD_LIBRARY_PATH="@QEMU_LD_LIBRARY_PATH@" \
+)
+linker="@LINKER@"
+
+while [ ${#} -gt 0 ]; do
+ case "${1}" in
+ -g|-L|-s|-cpu|-E|-U|-0|-r|-B|-R|-d|-D|-p)
+ args[${#args[@]}]="${1}"
+ args[${#args[@]}]="${2}"
+ shift 2
+ ;;
+ -*)
+ args[${#args[@]}]="${1}"
+ shift
+ ;;
+ *)
+ break
+ ;;
+ esac
+done
+
+args[${#args[@]}]="${linker}"
+args[${#args[@]}]="--inhibit-cache"
+if [ "$(realpath "${1}")" != "${linker}" ]; then
+ args[${#args[@]}]="$(realpath "${1}")"
+fi
+ shift
+if [ "${PTXDIST_VERBOSE}" = 1 -a -n "${PTXDIST_FD_LOGFILE}" ]; then
+ echo "qemu: ${args[@]} ${@}" >&${PTXDIST_FD_LOGFILE}
+fi
+exec "${args[@]}" "${@}"