rust: Link libunwind into Rust static executables.
Rust static executables fail to build due to missing unwind symbols.
Make sure we link libunwind when building these.
Bug: 194386505
Test: rust_binary with static_executable: true builds.
Change-Id: I74bab25e186e181bc1ac8fdd608687707c662e4d
diff --git a/rust/compiler.go b/rust/compiler.go
index 6b3ccfc..e0d89ac 100644
--- a/rust/compiler.go
+++ b/rust/compiler.go
@@ -362,7 +362,9 @@
} else {
deps.SharedLibs = append(deps.SharedLibs, bionicLibs...)
}
-
+ if ctx.RustModule().StaticExecutable() {
+ deps.StaticLibs = append(deps.StaticLibs, "libunwind")
+ }
if libRuntimeBuiltins := config.BuiltinsRuntimeLibrary(ctx.toolchain()); libRuntimeBuiltins != "" {
deps.StaticLibs = append(deps.StaticLibs, libRuntimeBuiltins)
}