Add -Wl,--exclude-libs=libclang_rt.builtins to ldflags

libclang_rt.builtins has default visiblity set to public and is the
last included static library for all modules.  This means that it is
possible for libraries to pick up libclang_rt.builtins from their
shared library dependencies, instead of libclang_rt.builtins directly.

Particularly, a vendor prebuilt in AOSP was picking up __floatditf()
from libhidlbase.so instead of from libclang_rt.builtins.  A change to
libhidlbase.so that removed the symbol caused thos prebuilt to fail to
link at runtime.

Bug: 138809247
Test: build, boot internal
Test: don't see libclang_rt.builtins symbols in libhidlbase.so

Merged-In: I0348c4860fe02cf88cb89f7ab356bd8c17826d77
Change-Id: I0348c4860fe02cf88cb89f7ab356bd8c17826d77
diff --git a/cc/linker.go b/cc/linker.go
index daacec1..fcf9dc7 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -378,6 +378,10 @@
 		flags.LdFlags = append(flags.LdFlags, "-lfdio", "-lzircon")
 	}
 
+	if ctx.toolchain().LibclangRuntimeLibraryArch() != "" {
+		flags.LdFlags = append(flags.LdFlags, "-Wl,--exclude-libs="+config.BuiltinsRuntimeLibrary(ctx.toolchain())+".a")
+	}
+
 	CheckBadLinkerFlags(ctx, "ldflags", linker.Properties.Ldflags)
 
 	flags.LdFlags = append(flags.LdFlags, proptools.NinjaAndShellEscapeList(linker.Properties.Ldflags)...)