Merge "rust: Drop libgcc dependency"
This commit is contained in:
@@ -87,7 +87,7 @@ func (binary *binaryDecorator) compilerDeps(ctx DepsContext, deps Deps) Deps {
|
|||||||
deps = binary.baseCompiler.compilerDeps(ctx, deps)
|
deps = binary.baseCompiler.compilerDeps(ctx, deps)
|
||||||
|
|
||||||
if ctx.toolchain().Bionic() {
|
if ctx.toolchain().Bionic() {
|
||||||
deps = bionicDeps(deps, Bool(binary.Properties.Static_executable))
|
deps = bionicDeps(ctx, deps, Bool(binary.Properties.Static_executable))
|
||||||
if Bool(binary.Properties.Static_executable) {
|
if Bool(binary.Properties.Static_executable) {
|
||||||
deps.CrtBegin = "crtbegin_static"
|
deps.CrtBegin = "crtbegin_static"
|
||||||
} else {
|
} else {
|
||||||
|
@@ -260,7 +260,7 @@ func NewRustBindgen(hod android.HostOrDeviceSupported) (*Module, *bindgenDecorat
|
|||||||
func (b *bindgenDecorator) SourceProviderDeps(ctx DepsContext, deps Deps) Deps {
|
func (b *bindgenDecorator) SourceProviderDeps(ctx DepsContext, deps Deps) Deps {
|
||||||
deps = b.BaseSourceProvider.SourceProviderDeps(ctx, deps)
|
deps = b.BaseSourceProvider.SourceProviderDeps(ctx, deps)
|
||||||
if ctx.toolchain().Bionic() {
|
if ctx.toolchain().Bionic() {
|
||||||
deps = bionicDeps(deps, false)
|
deps = bionicDeps(ctx, deps, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
deps.SharedLibs = append(deps.SharedLibs, b.ClangProperties.Shared_libs...)
|
deps.SharedLibs = append(deps.SharedLibs, b.ClangProperties.Shared_libs...)
|
||||||
|
@@ -281,7 +281,7 @@ func (compiler *baseCompiler) compilerDeps(ctx DepsContext, deps Deps) Deps {
|
|||||||
return deps
|
return deps
|
||||||
}
|
}
|
||||||
|
|
||||||
func bionicDeps(deps Deps, static bool) Deps {
|
func bionicDeps(ctx DepsContext, deps Deps, static bool) Deps {
|
||||||
bionicLibs := []string{}
|
bionicLibs := []string{}
|
||||||
bionicLibs = append(bionicLibs, "liblog")
|
bionicLibs = append(bionicLibs, "liblog")
|
||||||
bionicLibs = append(bionicLibs, "libc")
|
bionicLibs = append(bionicLibs, "libc")
|
||||||
@@ -294,9 +294,9 @@ func bionicDeps(deps Deps, static bool) Deps {
|
|||||||
deps.SharedLibs = append(deps.SharedLibs, bionicLibs...)
|
deps.SharedLibs = append(deps.SharedLibs, bionicLibs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO(b/141331117) libstd requires libgcc on Android
|
if libRuntimeBuiltins := config.BuiltinsRuntimeLibrary(ctx.toolchain()); libRuntimeBuiltins != "" {
|
||||||
deps.StaticLibs = append(deps.StaticLibs, "libgcc")
|
deps.StaticLibs = append(deps.StaticLibs, libRuntimeBuiltins)
|
||||||
|
}
|
||||||
return deps
|
return deps
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -53,6 +53,7 @@ var (
|
|||||||
|
|
||||||
deviceGlobalRustFlags = []string{
|
deviceGlobalRustFlags = []string{
|
||||||
"-C panic=abort",
|
"-C panic=abort",
|
||||||
|
"-Z link-native-libraries=no",
|
||||||
}
|
}
|
||||||
|
|
||||||
deviceGlobalLinkFlags = []string{
|
deviceGlobalLinkFlags = []string{
|
||||||
@@ -62,7 +63,7 @@ var (
|
|||||||
// Override cc's --no-undefined-version to allow rustc's generated alloc functions
|
// Override cc's --no-undefined-version to allow rustc's generated alloc functions
|
||||||
"-Wl,--undefined-version",
|
"-Wl,--undefined-version",
|
||||||
|
|
||||||
"-Bdynamic",
|
"-Wl,-Bdynamic",
|
||||||
"-nostdlib",
|
"-nostdlib",
|
||||||
"-Wl,--pack-dyn-relocs=android+relr",
|
"-Wl,--pack-dyn-relocs=android+relr",
|
||||||
"-Wl,--use-android-relr-tags",
|
"-Wl,--use-android-relr-tags",
|
||||||
|
@@ -112,6 +112,10 @@ func (toolchainBase) LibclangRuntimeLibraryArch() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func BuiltinsRuntimeLibrary(t Toolchain) string {
|
||||||
|
return LibclangRuntimeLibrary(t, "builtins")
|
||||||
|
}
|
||||||
|
|
||||||
func LibFuzzerRuntimeLibrary(t Toolchain) string {
|
func LibFuzzerRuntimeLibrary(t Toolchain) string {
|
||||||
return LibclangRuntimeLibrary(t, "fuzzer")
|
return LibclangRuntimeLibrary(t, "fuzzer")
|
||||||
}
|
}
|
||||||
|
@@ -404,7 +404,7 @@ func (library *libraryDecorator) compilerDeps(ctx DepsContext, deps Deps) Deps {
|
|||||||
deps = library.baseCompiler.compilerDeps(ctx, deps)
|
deps = library.baseCompiler.compilerDeps(ctx, deps)
|
||||||
|
|
||||||
if ctx.toolchain().Bionic() && (library.dylib() || library.shared()) {
|
if ctx.toolchain().Bionic() && (library.dylib() || library.shared()) {
|
||||||
deps = bionicDeps(deps, false)
|
deps = bionicDeps(ctx, deps, false)
|
||||||
deps.CrtBegin = "crtbegin_so"
|
deps.CrtBegin = "crtbegin_so"
|
||||||
deps.CrtEnd = "crtend_so"
|
deps.CrtEnd = "crtend_so"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user