diff options
Diffstat (limited to 'rust/compiler.go')
| -rw-r--r-- | rust/compiler.go | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/rust/compiler.go b/rust/compiler.go index 3fa3ccd69..4c7961d44 100644 --- a/rust/compiler.go +++ b/rust/compiler.go @@ -82,9 +82,6 @@ type BaseCompilerProperties struct { // not directly used as source files. Crate_root *string `android:"path,arch_variant"` - // Additional data files that are used during compilation only. These are not accessible at runtime. - Compile_data []string `android:"path,arch_variant"` - // name of the lint set that should be used to validate this module. // // Possible values are "default" (for using a sensible set of lints @@ -163,7 +160,7 @@ type BaseCompilerProperties struct { Relative_install_path *string `android:"arch_variant"` // whether to suppress inclusion of standard crates - defaults to false - No_stdlibs *bool + No_stdlibs *bool `android:"arch_variant"` // Change the rustlibs linkage to select rlib linkage by default for device targets. // Also link libstd as an rlib as well on device targets. @@ -330,10 +327,15 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag flags.LinkFlags = append(flags.LinkFlags, cc.RpathFlags(ctx)...) } - if !ctx.toolchain().Bionic() && ctx.Os() != android.LinuxMusl && !ctx.Windows() { - // Add -ldl, -lpthread, -lm and -lrt to host builds to match the default behavior of device - // builds. This is irrelevant for the Windows target as these are Posix specific. + if ctx.Os() == android.Linux { + // Add -lc, -lrt, -ldl, -lpthread, -lm and -lgcc_s to glibc builds to match + // the default behavior of device builds. + flags.LinkFlags = append(flags.LinkFlags, config.LinuxHostGlobalLinkFlags...) + } else if ctx.Os() == android.Darwin { + // Add -lc, -ldl, -lpthread and -lm to glibc darwin builds to match the default + // behavior of device builds. flags.LinkFlags = append(flags.LinkFlags, + "-lc", "-ldl", "-lpthread", "-lm", @@ -346,23 +348,6 @@ func (compiler *baseCompiler) compile(ctx ModuleContext, flags Flags, deps PathD panic(fmt.Errorf("baseCrater doesn't know how to crate things!")) } -func (compile *baseCompiler) crateRoot(ctx ModuleContext) android.Path { - if compile.Properties.Crate_root != nil { - return android.PathForModuleSrc(ctx, *compile.Properties.Crate_root) - } - return nil -} - -// compilationSourcesAndData returns a list of files necessary to complete the compilation. -// This includes the rust source files as well as any other data files that -// are referenced during the build. -func (compile *baseCompiler) compilationSourcesAndData(ctx ModuleContext) android.Paths { - return android.PathsForModuleSrc(ctx, android.Concat( - compile.Properties.Srcs, - compile.Properties.Compile_data, - )) -} - func (compiler *baseCompiler) rustdoc(ctx ModuleContext, flags Flags, deps PathDeps) android.OptionalPath { |