diff options
Diffstat (limited to 'rust/compiler.go')
| -rw-r--r-- | rust/compiler.go | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/rust/compiler.go b/rust/compiler.go index e6a7a9356..6f61798be 100644 --- a/rust/compiler.go +++ b/rust/compiler.go @@ -73,6 +73,15 @@ type BaseCompilerProperties struct { // If no source file is defined, a single generated source module can be defined to be used as the main source. Srcs []string `android:"path,arch_variant"` + // Entry point that is passed to rustc to begin the compilation. E.g. main.rs or lib.rs. + // When this property is set, + // * sandboxing is enabled for this module, and + // * the srcs attribute is interpreted as a list of all source files potentially + // used in compilation, including the entrypoint, and + // * compile_data can be used to add additional files used in compilation that + // not directly used as source files. + Crate_root *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 @@ -319,12 +328,15 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag } 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 + // Add -lc, -lrt, -ldl, -lpthread, -lm, -lrt and -lgcc_s to host builds to match the default behavior of device // builds. This is irrelevant for the Windows target as these are Posix specific. flags.LinkFlags = append(flags.LinkFlags, + "-lc", + "-lrt", "-ldl", "-lpthread", "-lm", + "-lgcc_s", ) } return flags @@ -511,6 +523,8 @@ func srcPathFromModuleSrcs(ctx ModuleContext, srcs []string) (android.Path, andr ctx.PropertyErrorf("srcs", "only a single generated source module can be defined without a main source file.") } + // TODO: b/297264540 - once all modules are sandboxed, we need to select the proper + // entry point file from Srcs rather than taking the first one paths := android.PathsForModuleSrc(ctx, srcs) return paths[srcIndex], paths[1:] } |