A shell script to build the vdso using the cross-compiler makefile fragment. If none detected, fall back to copying the pre-build vdso from the source directory.
Signed-off-by: Richard Henderson <richard.hender...@linaro.org> --- linux-user/build-vdso.sh | 31 +++++++++++++++++++++++++++++++ linux-user/meson.build | 1 + 2 files changed, 32 insertions(+) create mode 100755 linux-user/build-vdso.sh diff --git a/linux-user/build-vdso.sh b/linux-user/build-vdso.sh new file mode 100755 index 0000000000..489088737f --- /dev/null +++ b/linux-user/build-vdso.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# Build vdso using cross tools + +build_dir=error +source_dir=error +target_dir=error +output=error + +while test $# -gt 0; do + opt="$1" + shift + case "$opt" in + -B) build_dir=$1; shift;; + -C) source_dir=$1; shift;; + -T) target_dir=$1; shift;; + -o) output=$1; shift;; + --) break;; + esac +done + +frag="${build_dir}/tests/tcg/${target_dir}/config-target.mak" +if ! test -f "$frag"; then + # No cross-compiler available + # Copy pre-build image into build tree + cp "${source_dir}/$(basename ${output})" "${output}" + exit $? +fi + +# Extract cross-compiler from the makefile fragment, and build. +CC=$(grep CC= "$frag" | sed s/CC=//) +exec $CC -o "$output" $@ diff --git a/linux-user/meson.build b/linux-user/meson.build index e4cb70ed2d..099e5c4fe0 100644 --- a/linux-user/meson.build +++ b/linux-user/meson.build @@ -30,6 +30,7 @@ linux_user_ss.add(when: 'CONFIG_ARM_COMPATIBLE_SEMIHOSTING', if_true: files('sem syscall_nr_generators = {} +build_vdso_cmd = find_program('build-vdso.sh') gen_vdso_exe = executable('gen-vdso', 'gen-vdso.c', native: true, build_by_default: false) gen_vdso = generator(gen_vdso_exe, output: '@basen...@.c.inc', -- 2.34.1