summaryrefslogtreecommitdiff
path: root/rust/library.go
diff options
context:
space:
mode:
Diffstat (limited to 'rust/library.go')
-rw-r--r--rust/library.go21
1 files changed, 12 insertions, 9 deletions
diff --git a/rust/library.go b/rust/library.go
index 971588d8a..9d731e68f 100644
--- a/rust/library.go
+++ b/rust/library.go
@@ -159,14 +159,6 @@ func (library *libraryDecorator) static() bool {
return library.MutatedProperties.VariantIsStatic
}
-func (library *libraryDecorator) stdLinkage(ctx *depsContext) RustLinkage {
- // libraries should only request the RlibLinkage when building a static FFI or when variant is StaticStd
- if library.static() || library.MutatedProperties.VariantIsStaticStd {
- return RlibLinkage
- }
- return DefaultLinkage
-}
-
func (library *libraryDecorator) source() bool {
return library.MutatedProperties.VariantIsSource
}
@@ -228,7 +220,9 @@ func (library *libraryDecorator) setSource() {
}
func (library *libraryDecorator) autoDep(ctx BaseModuleContext) autoDep {
- if library.rlib() || library.static() {
+ if library.preferRlib() {
+ return rlibAutoDep
+ } else if library.rlib() || library.static() {
return rlibAutoDep
} else if library.dylib() || library.shared() {
return dylibAutoDep
@@ -237,6 +231,15 @@ func (library *libraryDecorator) autoDep(ctx BaseModuleContext) autoDep {
}
}
+func (library *libraryDecorator) stdLinkage(ctx *depsContext) RustLinkage {
+ if library.static() || library.MutatedProperties.VariantIsStaticStd {
+ return RlibLinkage
+ } else if library.baseCompiler.preferRlib() {
+ return RlibLinkage
+ }
+ return DefaultLinkage
+}
+
var _ compiler = (*libraryDecorator)(nil)
var _ libraryInterface = (*libraryDecorator)(nil)
var _ exportedFlagsProducer = (*libraryDecorator)(nil)