blob: c3aa41a7227b4aba4e5f5580daa7cdc61fefb3d1 [file] [log] [blame]
Vic Yang51512c52018-11-12 20:16:26 -08001#!/bin/bash
2set -e
3
4STRIP_PATH="${1}"
5CORE="${2}"
6VENDOR="${3}"
7
Vic Yang4873e652020-01-08 14:39:10 -08008TMPDIR="$(mktemp -d ${CORE}.vndk_lib_check.XXXXXXXX)"
9stripped_core="${TMPDIR}/core"
10stripped_vendor="${TMPDIR}/vendor"
Vic Yang51512c52018-11-12 20:16:26 -080011
12function cleanup() {
Vic Yang4873e652020-01-08 14:39:10 -080013 rm -f "${stripped_core}" "${stripped_vendor}"
14 rmdir "${TMPDIR}"
Vic Yang51512c52018-11-12 20:16:26 -080015}
16trap cleanup EXIT
17
18function strip_lib() {
19 ${STRIP_PATH} \
20 -i ${1} \
21 -o ${2} \
22 -d /dev/null \
23 --remove-build-id
24}
25
26strip_lib ${CORE} ${stripped_core}
27strip_lib ${VENDOR} ${stripped_vendor}
28if ! cmp -s ${stripped_core} ${stripped_vendor}; then
29 echo "VNDK library not in vndkMustUseVendorVariantList but has different core and vendor variant: $(basename ${CORE})"
30 echo "If the two variants need to have different runtime behavior, consider using libvndksupport."
31 exit 1
32fi