summaryrefslogtreecommitdiff
path: root/rust/builder.go
diff options
context:
space:
mode:
author Matthew Maurer <mmaurer@google.com> 2025-01-07 01:45:14 +0000
committer Matthew Maurer <mmaurer@google.com> 2025-01-07 17:42:42 +0000
commitf67d211c0b948787f0897ff0964011ddd7cab9a3 (patch)
tree276c341d5f60362418fdb35b49b560b5a79d5002 /rust/builder.go
parent5a4f022c9d8fed286e891fb77b3ab2d59138aafa (diff)
rust: Force all dependencies to be linked, used or not
`rustc` added an unstable feature that makes `--extern` do what we originally wanted - it links the provided library, *even* if the source code does not reference it. The primary use case for this is that it makes it possible for us to build dylibs out of `#![no_std]` crates without modifying the source, because we can pass in `--extern force:path/to/libstd.dylib.so`. Bug: 168927099 Test: m, TH Change-Id: Ibc3b75012d54b73e40ae609784cdc74e02e8f008
Diffstat (limited to 'rust/builder.go')
-rw-r--r--rust/builder.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/rust/builder.go b/rust/builder.go
index e5434efee..8a869aad8 100644
--- a/rust/builder.go
+++ b/rust/builder.go
@@ -264,7 +264,7 @@ func makeLibFlags(deps PathDeps) []string {
libFlags = append(libFlags, "--extern "+lib.CrateName+"="+lib.Path.String())
}
for _, lib := range deps.DyLibs {
- libFlags = append(libFlags, "--extern "+lib.CrateName+"="+lib.Path.String())
+ libFlags = append(libFlags, "--extern force:"+lib.CrateName+"="+lib.Path.String())
}
for _, proc_macro := range deps.ProcMacros {
libFlags = append(libFlags, "--extern "+proc_macro.CrateName+"="+proc_macro.Path.String())