Add an option for libraries to opt out of libcrt

am: 2c188bea78

Change-Id: Ic78a8733437f360d60e96431230df0f02577a865
This commit is contained in:
Yi Kong
2018-10-10 18:02:41 -07:00
committed by android-build-merger

View File

@@ -59,6 +59,9 @@ type BaseLinkerProperties struct {
// don't link in libgcc.a // don't link in libgcc.a
No_libgcc *bool No_libgcc *bool
// don't link in libclang_rt.builtins-*.a
No_libcrt *bool
// Use clang lld instead of gnu ld. // Use clang lld instead of gnu ld.
Use_clang_lld *bool `android:"arch_variant"` Use_clang_lld *bool `android:"arch_variant"`
@@ -216,10 +219,14 @@ func (linker *baseLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
} }
if ctx.toolchain().Bionic() { if ctx.toolchain().Bionic() {
// libclang_rt.builtins, libgcc and libatomic have to be last on the command line // Allow individual projects to opt out of libcrt,builtins
// TODO: Also enable for libc and libm // b/117565638
if ctx.ModuleName() != "libc" && ctx.ModuleName() != "libm" { if !Bool(linker.Properties.No_libcrt) {
deps.LateStaticLibs = append(deps.LateStaticLibs, config.BuiltinsRuntimeLibrary(ctx.toolchain())) // libclang_rt.builtins, libgcc and libatomic have to be last on the command line
// TODO: Also enable for libc and libm
if ctx.ModuleName() != "libc" && ctx.ModuleName() != "libm" {
deps.LateStaticLibs = append(deps.LateStaticLibs, config.BuiltinsRuntimeLibrary(ctx.toolchain()))
}
} }
deps.LateStaticLibs = append(deps.LateStaticLibs, "libatomic") deps.LateStaticLibs = append(deps.LateStaticLibs, "libatomic")