Merge "Preopt: Do not strip non-image boot class path jars."
diff --git a/cc/config/clang.go b/cc/config/clang.go
index a0ebd10..832689b 100644
--- a/cc/config/clang.go
+++ b/cc/config/clang.go
@@ -135,10 +135,6 @@
 		// codebase for it.
 		"-Wno-inconsistent-missing-override",
 
-		// Bug: http://b/29823425 Disable -Wnull-dereference until the
-		// new instances detected by this warning are fixed.
-		"-Wno-null-dereference",
-
 		// Enable clang's thread-safety annotations in libcxx.
 		// Turn off -Wthread-safety-negative, to avoid breaking projects that use -Weverything.
 		"-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS",
@@ -187,6 +183,10 @@
 		// http://b/72331524 Allow null pointer arithmetic until the instances detected by
 		// this new warning are fixed.
 		"-Wno-null-pointer-arithmetic",
+
+		// Bug: http://b/29823425 Disable -Wnull-dereference until the
+		// new instances detected by this warning are fixed.
+		"-Wno-null-dereference",
 	}, " "))
 }
 
diff --git a/cc/library.go b/cc/library.go
index da223dc..4adb081 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -646,6 +646,11 @@
 			linkerDeps = append(linkerDeps, forceWeakSymbols.Path())
 		}
 	}
+	if library.buildStubs() {
+		linkerScriptFlags := "-Wl,--version-script," + library.versionScriptPath.String()
+		flags.LdFlags = append(flags.LdFlags, linkerScriptFlags)
+		linkerDeps = append(linkerDeps, library.versionScriptPath)
+	}
 
 	fileName := library.getLibName(ctx) + flags.Toolchain.ShlibSuffix()
 	outputFile := android.PathForModuleOut(ctx, fileName)
diff --git a/ui/build/ninja.go b/ui/build/ninja.go
index e5d6da1..835f820 100644
--- a/ui/build/ninja.go
+++ b/ui/build/ninja.go
@@ -54,7 +54,9 @@
 
 	args = append(args, "-f", config.CombinedNinjaFile())
 
-	args = append(args, "-w", "dupbuild=err")
+	args = append(args,
+		"-w", "dupbuild=err",
+		"-w", "missingdepfile=err")
 
 	cmd := Command(ctx, config, "ninja", executable, args...)
 	if config.HasKatiSuffix() {
diff --git a/ui/build/paths/config.go b/ui/build/paths/config.go
index 87f1e4e..fdd291e 100644
--- a/ui/build/paths/config.go
+++ b/ui/build/paths/config.go
@@ -85,7 +85,6 @@
 	"egrep":     Allowed,
 	"find":      Allowed,
 	"fuser":     Allowed,
-	"getconf":   Allowed,
 	"getopt":    Allowed,
 	"git":       Allowed,
 	"grep":      Allowed,
@@ -95,11 +94,9 @@
 	"jar":       Allowed,
 	"java":      Allowed,
 	"javap":     Allowed,
-	"ls":        Allowed,
 	"lsof":      Allowed,
 	"m4":        Allowed,
 	"md5sum":    Allowed,
-	"mktemp":    Allowed,
 	"mv":        Allowed,
 	"openssl":   Allowed,
 	"patch":     Allowed,
@@ -120,7 +117,6 @@
 	"sha256sum": Allowed,
 	"sha512sum": Allowed,
 	"sort":      Allowed,
-	"stat":      Allowed,
 	"tar":       Allowed,
 	"timeout":   Allowed,
 	"tr":        Allowed,
@@ -159,15 +155,19 @@
 	"env":      Toybox,
 	"expr":     Toybox,
 	"head":     Toybox,
+	"getconf":  Toybox,
 	"id":       Toybox,
 	"ln":       Toybox,
+	"ls":       Toybox,
 	"mkdir":    Toybox,
+	"mktemp":   Toybox,
 	"od":       Toybox,
 	"paste":    Toybox,
 	"pwd":      Toybox,
 	"rmdir":    Toybox,
 	"setsid":   Toybox,
 	"sleep":    Toybox,
+	"stat":     Toybox,
 	"tail":     Toybox,
 	"tee":      Toybox,
 	"touch":    Toybox,