summaryrefslogtreecommitdiff
path: root/rust/builder.go
diff options
context:
space:
mode:
Diffstat (limited to 'rust/builder.go')
-rw-r--r--rust/builder.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/rust/builder.go b/rust/builder.go
index 654b1e6bf..3e082dc2f 100644
--- a/rust/builder.go
+++ b/rust/builder.go
@@ -22,6 +22,7 @@ import (
"android/soong/android"
"android/soong/cc"
+ "android/soong/rust/config"
)
var (
@@ -138,6 +139,13 @@ func transformSrctoCrate(ctx ModuleContext, main android.Path, deps PathDeps, fl
crate_name := ctx.RustModule().CrateName()
targetTriple := ctx.toolchain().RustTriple()
+ // libstd requires a specific environment variable to be set. This is
+ // not officially documented and may be removed in the future. See
+ // https://github.com/rust-lang/rust/blob/master/library/std/src/env.rs#L866.
+ if crate_name == "std" {
+ envVars = append(envVars, "STD_ENV_ARCH="+config.StdEnvArch[ctx.RustModule().Arch().ArchType])
+ }
+
inputs = append(inputs, main)
// Collect rustc flags