Merge changes from topic "crt_cflags"

* changes:
  Remove no_default_compiler_flags property
  Move -fomit-frame-pointer to armCflags
  Consolidate ldflags that are used on all devices
  Remove -Wl,--gc-sections from target flags
  Consolidate cflags that are set on all devices
  Consolidate global cflags
diff --git a/android/arch.go b/android/arch.go
index f8317bb..5ea9759 100644
--- a/android/arch.go
+++ b/android/arch.go
@@ -973,8 +973,6 @@
 	return []archConfig{
 		{"arm", "armv5te", "", []string{"armeabi"}},
 		{"arm64", "armv8-a", "", []string{"arm64-v8a"}},
-		{"mips", "mips32-fp", "", []string{"mips"}},
-		{"mips64", "mips64r6", "", []string{"mips64"}},
 		{"x86", "", "", []string{"x86"}},
 		{"x86_64", "", "", []string{"x86_64"}},
 	}
diff --git a/cc/test.go b/cc/test.go
index 9df3467..53c984a 100644
--- a/cc/test.go
+++ b/cc/test.go
@@ -47,39 +47,39 @@
 }
 
 func init() {
-	android.RegisterModuleType("cc_test", testFactory)
-	android.RegisterModuleType("cc_test_library", testLibraryFactory)
-	android.RegisterModuleType("cc_benchmark", benchmarkFactory)
-	android.RegisterModuleType("cc_test_host", testHostFactory)
-	android.RegisterModuleType("cc_benchmark_host", benchmarkHostFactory)
+	android.RegisterModuleType("cc_test", TestFactory)
+	android.RegisterModuleType("cc_test_library", TestLibraryFactory)
+	android.RegisterModuleType("cc_benchmark", BenchmarkFactory)
+	android.RegisterModuleType("cc_test_host", TestHostFactory)
+	android.RegisterModuleType("cc_benchmark_host", BenchmarkHostFactory)
 }
 
 // Module factory for tests
-func testFactory() android.Module {
+func TestFactory() android.Module {
 	module := NewTest(android.HostAndDeviceSupported)
 	return module.Init()
 }
 
 // Module factory for test libraries
-func testLibraryFactory() android.Module {
+func TestLibraryFactory() android.Module {
 	module := NewTestLibrary(android.HostAndDeviceSupported)
 	return module.Init()
 }
 
 // Module factory for benchmarks
-func benchmarkFactory() android.Module {
+func BenchmarkFactory() android.Module {
 	module := NewBenchmark(android.HostAndDeviceSupported)
 	return module.Init()
 }
 
 // Module factory for host tests
-func testHostFactory() android.Module {
+func TestHostFactory() android.Module {
 	module := NewTest(android.HostSupported)
 	return module.Init()
 }
 
 // Module factory for host benchmarks
-func benchmarkHostFactory() android.Module {
+func BenchmarkHostFactory() android.Module {
 	module := NewBenchmark(android.HostSupported)
 	return module.Init()
 }
diff --git a/java/config/config.go b/java/config/config.go
index c19a705..654d935 100644
--- a/java/config/config.go
+++ b/java/config/config.go
@@ -80,14 +80,18 @@
 	pctx.HostBinToolVariable("SoongZipCmd", "soong_zip")
 	pctx.HostBinToolVariable("MergeZipsCmd", "merge_zips")
 	pctx.VariableFunc("DxCmd", func(config interface{}) (string, error) {
-		dexer := "d8"
 		if config.(android.Config).IsEnvFalse("USE_D8") {
-			dexer = "dx"
-		}
-		if config.(android.Config).UnbundledBuild() || config.(android.Config).IsPdkBuild() {
-			return "prebuilts/build-tools/common/bin/" + dexer, nil
+			if config.(android.Config).UnbundledBuild() || config.(android.Config).IsPdkBuild() {
+				return "prebuilts/build-tools/common/bin/dx", nil
+			} else {
+				path, err := pctx.HostBinToolPath(config, "dx")
+				if err != nil {
+					return "", err
+				}
+				return path.String(), nil
+			}
 		} else {
-			path, err := pctx.HostBinToolPath(config, dexer)
+			path, err := pctx.HostBinToolPath(config, "d8-compat-dx")
 			if err != nil {
 				return "", err
 			}
diff --git a/java/java.go b/java/java.go
index 1541dec..f9a4c04 100644
--- a/java/java.go
+++ b/java/java.go
@@ -869,7 +869,7 @@
 
 	binaryProperties binaryProperties
 
-	wrapperFile android.ModuleSrcPath
+	wrapperFile android.SourcePath
 	binaryFile  android.OutputPath
 }
 
@@ -882,7 +882,11 @@
 
 	// Depend on the installed jar (j.installFile) so that the wrapper doesn't get executed by
 	// another build rule before the jar has been installed.
-	j.wrapperFile = android.PathForModuleSrc(ctx, j.binaryProperties.Wrapper)
+	if j.binaryProperties.Wrapper != "" {
+		j.wrapperFile = android.PathForModuleSrc(ctx, j.binaryProperties.Wrapper).SourcePath
+	} else {
+		j.wrapperFile = android.PathForSource(ctx, "build/soong/scripts/jar-wrapper.sh")
+	}
 	j.binaryFile = ctx.InstallExecutable(android.PathForModuleInstall(ctx, "bin"),
 		ctx.ModuleName(), j.wrapperFile, j.installFile)
 }
diff --git a/root.bp b/root.bp
index 6788fa7..bc59171 100644
--- a/root.bp
+++ b/root.bp
@@ -29,6 +29,7 @@
     "packages/apps/*",
     "prebuilts/clang/host/linux-x86",
     "prebuilts/ndk",
+    "prebuilts/r8",
     "prebuilts/sdk",
     "prebuilts/misc",
     "system/*",
diff --git a/scripts/jar-wrapper.sh b/scripts/jar-wrapper.sh
new file mode 100644
index 0000000..71c1d90
--- /dev/null
+++ b/scripts/jar-wrapper.sh
@@ -0,0 +1,58 @@
+#!/bin/bash
+#
+# Copyright (C) 2007 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Set up prog to be the path of this script, including following symlinks,
+# and set up progdir to be the fully-qualified pathname of its directory.
+
+prog="$0"
+while [ -h "${prog}" ]; do
+    fullprog=`/bin/ls -ld "${prog}"`
+    fullprog=`expr "${fullprog}" : ".* -> \(.*\)$"`
+    if expr "x${fullprog}" : 'x/' >/dev/null; then
+        prog="${fullprog}"
+    else
+        progdir=`dirname "${prog}"`
+        prog="${progdir}/${fullprog}"
+    fi
+done
+
+oldwd=`pwd`
+progdir=`dirname "${prog}"`
+cd "${progdir}"
+progdir=`pwd`
+prog="${progdir}"/`basename "${prog}"`
+cd "${oldwd}"
+
+jarfile=`basename "${prog}"`.jar
+jardir="${progdir}"
+
+if [ ! -r "${jardir}/${jarfile}" ]; then
+    jardir=`dirname "${progdir}"`/framework
+fi
+
+if [ ! -r "${jardir}/${jarfile}" ]; then
+    echo `basename "${prog}"`": can't find ${jarfile}"
+    exit 1
+fi
+
+javaOpts=""
+while expr "x$1" : 'x-J' >/dev/null; do
+    opt=`expr "$1" : '-J\(.*\)'`
+    javaOpts="${javaOpts} -${opt}"
+    shift
+done
+
+exec java ${javaOpts} -jar ${jardir}/${jarfile} "$@"