Support VNDK extensions

This commit adds `extends: "name"` property and provides basic support
to VNDK extensions.  This is the simplest example:

```
cc_library {
    name: "libvndk",
    vendor_available: true,
    vndk {
        enabled: true,
    },
}

cc_library {
    name: "libvndk_ext",
    vendor: true,
    vndk: {
        enabled: true,
        extends: "libvndk",
    },
}
```

A vndk extension library must extend an existing vndk library which has
`vendor_available: true`.  These two libraries must have the same
`support_system_process` property.

VNDK-ext libraries are installed to `/vendor/lib[64]/vndk` and
VNDK-SP-ext libraries are installed to `/vendor/lib[64]/vndk-sp` by
default.

If there is a matching abi-dumps in `prebuilts/abi-dumps`,
`header-abi-diff` will be invoked to check for ABI breakages.

Bug: 38340960

Test: lunch aosp_walleye-userdebug && make -j8   # runs unit tests

Test: lunch aosp_arm-userdebug && make -j8  # build a target w/o VNDK

Test: Create a lsdump for a vndk lib, add an exported API to vndk lib,
and build fails as expected.

Test: Create a lsdump for a vndk lib, create an vndk extension lib with
extra API, and build succeeds as expected.

Test: Create libutils_ext, add an extra function to libutils_ext, and
call it from a HIDL service.

Change-Id: Iba90e08848ee99814405457f047321e6b52b2df0
diff --git a/cc/builder.go b/cc/builder.go
index 1e1c4f2..fe35d5c 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -38,7 +38,6 @@
 
 var (
 	abiCheckAllowFlags = []string{
-		"-allow-extensions",
 		"-allow-unreferenced-changes",
 		"-allow-unreferenced-elf-symbol-changes",
 	}
@@ -711,12 +710,18 @@
 }
 
 func SourceAbiDiff(ctx android.ModuleContext, inputDump android.Path, referenceDump android.Path,
-	baseName, exportedHeaderFlags string) android.OptionalPath {
+	baseName, exportedHeaderFlags string, isVndkExt bool) android.OptionalPath {
+
 	outputFile := android.PathForModuleOut(ctx, baseName+".abidiff")
+
 	localAbiCheckAllowFlags := append([]string(nil), abiCheckAllowFlags...)
 	if exportedHeaderFlags == "" {
 		localAbiCheckAllowFlags = append(localAbiCheckAllowFlags, "-advice-only")
 	}
+	if isVndkExt {
+		localAbiCheckAllowFlags = append(localAbiCheckAllowFlags, "-allow-extensions")
+	}
+
 	ctx.Build(pctx, android.BuildParams{
 		Rule:        sAbiDiff,
 		Description: "header-abi-diff " + outputFile.Base(),