Add support for no-vendor-variant VNDK

When no-vendor-variant VNDK is enabled, the vendor variant of VNDK
libraries are not installed.  Since not all VNDK libraries will be
ready for this, we keep a list of library names in cc/vndk.go to
indicate which libraries must have their vendor variants always
installed regardless of whether no-vendor-variant VNDK is enabled.

Also add --remove-build-id option to the strip script to facilitate
the check of functional identity of the two variants.

Bug: 119423884
Test: Add a dummy VNDK library and build with
      TARGET_VNDK_USE_CORE_VARIANT := true, with the corresponding
      build/make change.

Change-Id: Ieb1589488690e1cef1e310669a8b47a8b8759dac
diff --git a/scripts/strip.sh b/scripts/strip.sh
index bedc527..d536907 100755
--- a/scripts/strip.sh
+++ b/scripts/strip.sh
@@ -28,6 +28,7 @@
 #   --keep-mini-debug-info
 #   --keep-symbols
 #   --use-gnu-strip
+#   --remove-build-id
 
 set -o pipefail
 
@@ -41,6 +42,7 @@
         --keep-mini-debug-info  Keep compressed debug info in out-file
         --keep-symbols          Keep symbols in out-file
         --use-gnu-strip         Use strip/objcopy instead of llvm-{strip,objcopy}
+        --remove-build-id       Remove the gnu build-id section in out-file
 EOF
     exit 1
 }
@@ -110,6 +112,16 @@
     fi
 }
 
+do_remove_build_id() {
+    if [ -z "${use_gnu_strip}" ]; then
+        "${CLANG_BIN}/llvm-strip" -remove-section=.note.gnu.build-id "${outfile}.tmp" -o "${outfile}.tmp.no-build-id"
+    else
+        "${CROSS_COMPILE}strip" --remove-section=.note.gnu.build-id "${outfile}.tmp" -o "${outfile}.tmp.no-build-id"
+    fi
+    rm -f "${outfile}.tmp"
+    mv "${outfile}.tmp.no-build-id" "${outfile}.tmp"
+}
+
 while getopts $OPTSTRING opt; do
     case "$opt" in
 	d) depsfile="${OPTARG}" ;;
@@ -120,7 +132,7 @@
 		add-gnu-debuglink) add_gnu_debuglink=true ;;
 		keep-mini-debug-info) keep_mini_debug_info=true ;;
 		keep-symbols) keep_symbols=true ;;
-		use-gnu-strip) use_gnu_strip=true ;;
+		remove-build-id) remove_build_id=true ;;
 		*) echo "Unknown option --${OPTARG}"; usage ;;
 	    esac;;
 	?) usage ;;
@@ -167,6 +179,10 @@
     do_add_gnu_debuglink
 fi
 
+if [ ! -z "${remove_build_id}" ]; then
+    do_remove_build_id
+fi
+
 rm -f "${outfile}"
 mv "${outfile}.tmp" "${outfile}"