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
This commit is contained in:
Tom Cherry
2019-08-06 10:03:25 -07:00
parent d62b4af8b7
commit e4802329e6

View File

@@ -378,6 +378,10 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
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)...)