summaryrefslogtreecommitdiff
path: root/rust/library.go
diff options
context:
space:
mode:
author Ivan Lozano <ivanlozano@google.com> 2025-02-05 09:12:07 -0800
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2025-02-05 09:12:07 -0800
commit46aceb31b440312a94af32188b76349b0b375e33 (patch)
tree36c817849e7f2e8e2e633d6a21b812a2a7cd7676 /rust/library.go
parente3089aca515e5840449530cf83ee6ac94fc66861 (diff)
parent1f10f684516b131b5e6aebdf9b7915cf07409510 (diff)
Merge "rust: Propagate static libs correctly" into main
Diffstat (limited to 'rust/library.go')
-rw-r--r--rust/library.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/rust/library.go b/rust/library.go
index 3686bf972..94f5730ea 100644
--- a/rust/library.go
+++ b/rust/library.go
@@ -674,7 +674,10 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa
flags.RustFlags = append(flags.RustFlags, deps.depFlags...)
flags.LinkFlags = append(flags.LinkFlags, deps.depLinkFlags...)
- flags.LinkFlags = append(flags.LinkFlags, deps.linkObjects...)
+ flags.LinkFlags = append(flags.LinkFlags, deps.rustLibObjects...)
+ flags.LinkFlags = append(flags.LinkFlags, deps.sharedLibObjects...)
+ flags.LinkFlags = append(flags.LinkFlags, deps.staticLibObjects...)
+ flags.LinkFlags = append(flags.LinkFlags, deps.wholeStaticLibObjects...)
if String(library.Properties.Version_script) != "" {
if String(library.Properties.Extra_exported_symbols) != "" {
@@ -722,9 +725,17 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa
ret.kytheFile = TransformSrctoShared(ctx, crateRootPath, deps, flags, outputFile).kytheFile
}
+ // rlibs and dylibs propagate their shared, whole static, and rustlib dependencies
if library.rlib() || library.dylib() {
library.flagExporter.exportLinkDirs(deps.linkDirs...)
- library.flagExporter.exportLinkObjects(deps.linkObjects...)
+ library.flagExporter.exportRustLibs(deps.rustLibObjects...)
+ library.flagExporter.exportSharedLibs(deps.sharedLibObjects...)
+ library.flagExporter.exportWholeStaticLibs(deps.wholeStaticLibObjects...)
+ }
+
+ // rlibs also propagate their staticlibs dependencies
+ if library.rlib() {
+ library.flagExporter.exportStaticLibs(deps.staticLibObjects...)
}
// Since we have FFI rlibs, we need to collect their includes as well
@@ -759,6 +770,7 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa
}
cc.AddStubDependencyProviders(ctx)
+ // Set our flagexporter provider to export relevant Rust flags
library.flagExporter.setProvider(ctx)
return ret