xref: /aosp_15_r20/external/crosvm/cuttlefish/crosvm_bionic (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
1*bb4ee6a4SAndroid Build Coastguard Worker#!/bin/bash
2*bb4ee6a4SAndroid Build Coastguard Worker
3*bb4ee6a4SAndroid Build Coastguard Worker# Execute crosvm using the Bionic linker. This is because DT_INTERP of the
4*bb4ee6a4SAndroid Build Coastguard Worker# host rust binaries are incorrectly set to /system/bin/linker64. The path
5*bb4ee6a4SAndroid Build Coastguard Worker# doesn't exist on host targets, but this is unavoidable because we are
6*bb4ee6a4SAndroid Build Coastguard Worker# building the host rust binaries using "-target aarch64-linux-android".
7*bb4ee6a4SAndroid Build Coastguard Worker# The target is for Android and therefore DT_INTERP is set to that of Android.
8*bb4ee6a4SAndroid Build Coastguard Worker# We have to use the target until rustc supports non-Android target using Bionic
9*bb4ee6a4SAndroid Build Coastguard Worker# as libc. Until then, let's override DT_INTERP by executing the dynamic linker
10*bb4ee6a4SAndroid Build Coastguard Worker# and feed the absolute path to the rust binary as the first argument.
11*bb4ee6a4SAndroid Build Coastguard Workerexec $(dirname $0)/linker64 $(readlink -f $(dirname $0)/$(uname -m)-linux-bionic/$(basename "$0")) "${@}"
12