Use soong_cc_prebuilt.mk instead of prebuilt.mk for Soong cc modules

Export Soong cc modules to Make using a new soong_cc_prebuilt.mk that
bypasses all of prebuilt_internal.mk, dynamic_binary.mk and binary.mk.
This also means that stripping is handled in Soong instead of Make.

Relands If9008c50920779048480f5eeeb0084f26006c998 with fixes for
mac builds.

Bug: 113936524
Test: m checkbuild
Change-Id: I9710ff57f0793f36eb889eabd08bd60a365a88dd
diff --git a/cc/prebuilt.go b/cc/prebuilt.go
index d6018eb..47994a8 100644
--- a/cc/prebuilt.go
+++ b/cc/prebuilt.go
@@ -82,6 +82,7 @@
 		in := p.Prebuilt.SingleSourcePath(ctx)
 
 		if p.shared() {
+			p.unstrippedOutputFile = in
 			libName := ctx.baseModuleName() + flags.Toolchain.ShlibSuffix()
 			if p.needsStrip(ctx) {
 				stripped := android.PathForModuleOut(ctx, "stripped", libName)
@@ -89,13 +90,11 @@
 				in = stripped
 			}
 
-			if !ctx.Darwin() && !ctx.Windows() {
-				// Optimize out relinking against shared libraries whose interface hasn't changed by
-				// depending on a table of contents file instead of the library itself.
-				tocFile := android.PathForModuleOut(ctx, libName+".toc")
-				p.tocFile = android.OptionalPathForPath(tocFile)
-				TransformSharedObjectToToc(ctx, in, tocFile, builderFlags)
-			}
+			// Optimize out relinking against shared libraries whose interface hasn't changed by
+			// depending on a table of contents file instead of the library itself.
+			tocFile := android.PathForModuleOut(ctx, libName+".toc")
+			p.tocFile = android.OptionalPathForPath(tocFile)
+			TransformSharedObjectToToc(ctx, in, tocFile, builderFlags)
 		}
 
 		return in
@@ -162,6 +161,8 @@
 		fileName := p.getStem(ctx) + flags.Toolchain.ExecutableSuffix()
 		in := p.Prebuilt.SingleSourcePath(ctx)
 
+		p.unstrippedOutputFile = in
+
 		if p.needsStrip(ctx) {
 			stripped := android.PathForModuleOut(ctx, "stripped", fileName)
 			p.strip(ctx, in, stripped, builderFlags)