Revert "Revert "Keep minimal abort when enabling integer overflow check""

This reverts commit c480fbc5efa0cf3caf1ecacab78522a256cb9e94.

When cherry-picking this change to a branch, make sure that the target:
* either DOES NOT include
  https://android-review.googlesource.com/c/platform/build/soong/+/1980451/
* or includes
  https://android-review.googlesource.com/c/platform/build/soong/+/2130354/

Bug: b/235090315
Bug: b/235181175
Bug: b/233840743
Test: libcutils.so (in symbols) includes more than 0 and less than 10 functions
      with __ubsan_handle in the name, and does not export any.

Change-Id: I4f30b5814b5460468004efcc543cc681ad0022dc
diff --git a/cc/sanitize.go b/cc/sanitize.go
index ff56058..8e0813d 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -715,10 +715,6 @@
 			flags.Local.CFlags = append(flags.Local.CFlags, "-fno-sanitize=vptr,function")
 		}
 
-		if enableMinimalRuntime(sanitize) {
-			flags.Local.CFlags = append(flags.Local.CFlags, strings.Join(minimalRuntimeFlags, " "))
-		}
-
 		if Bool(sanitize.Properties.Sanitize.Fuzzer) {
 			// When fuzzing, we wish to crash with diagnostics on any bug.
 			flags.Local.CFlags = append(flags.Local.CFlags, "-fno-sanitize-trap=all", "-fno-sanitize-recover=all")
@@ -727,6 +723,11 @@
 		} else {
 			flags.Local.CFlags = append(flags.Local.CFlags, "-fsanitize-trap=all", "-ftrap-function=abort")
 		}
+
+		if enableMinimalRuntime(sanitize) {
+			flags.Local.CFlags = append(flags.Local.CFlags, strings.Join(minimalRuntimeFlags, " "))
+		}
+
 		// http://b/119329758, Android core does not boot up with this sanitizer yet.
 		if toDisableImplicitIntegerChange(flags.Local.CFlags) {
 			flags.Local.CFlags = append(flags.Local.CFlags, "-fno-sanitize=implicit-integer-sign-change")