summaryrefslogtreecommitdiff
path: root/rust/rust.go
diff options
context:
space:
mode:
author Ivan Lozano <ivanlozano@google.com> 2023-02-06 13:31:02 -0500
committer Ivan Lozano <ivanlozano@google.com> 2023-02-06 13:48:23 -0500
commit0f9963e9e4b79566bee21e037b5d8e29adea9b8a (patch)
tree60f8d7472a91411f2a84e4fbcbef65560cf6b808 /rust/rust.go
parent8e0ae8e9607375b2ae64582c10a66d7b70a6d9b7 (diff)
Copy Rust fuzzer dependencies to /data.
Fix an issue where rust_fuzz modules were not correctly packaging and copying their dependencies. This is done by extending the CC fuzz packager to simply handle both Rust and CC modules, ensuring this doesn't get out of sync again. Fuzzer related functions are added to the Linkable interface to facilitate this. There was a bug where the Make definitions for Rust fuzzers were not being created as well, and that is addressed here. Bug: 249551848 Test: m android_log_fuzzer #check $OUT/data/fuzz/arm64/libs Change-Id: I9b41153e0cf08ab510476b75003c3a3baccc3858
Diffstat (limited to 'rust/rust.go')
-rw-r--r--rust/rust.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/rust/rust.go b/rust/rust.go
index 28a300bc6..67e0d7c03 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -208,6 +208,11 @@ func (mod *Module) OutputFiles(tag string) (android.Paths, error) {
}
return android.Paths{}, nil
}
+ case "unstripped":
+ if mod.compiler != nil {
+ return android.PathsIfNonNil(mod.compiler.unstrippedOutputFilePath()), nil
+ }
+ return nil, nil
default:
return nil, fmt.Errorf("unsupported module reference tag %q", tag)
}
@@ -619,6 +624,31 @@ func (mod *Module) CcLibraryInterface() bool {
return false
}
+func (mod *Module) IsFuzzModule() bool {
+ if _, ok := mod.compiler.(*fuzzDecorator); ok {
+ return true
+ }
+ return false
+}
+
+func (mod *Module) FuzzModuleStruct() fuzz.FuzzModule {
+ return mod.FuzzModule
+}
+
+func (mod *Module) FuzzPackagedModule() fuzz.FuzzPackagedModule {
+ if fuzzer, ok := mod.compiler.(*fuzzDecorator); ok {
+ return fuzzer.fuzzPackagedModule
+ }
+ panic(fmt.Errorf("FuzzPackagedModule called on non-fuzz module: %q", mod.BaseModuleName()))
+}
+
+func (mod *Module) FuzzSharedLibraries() android.Paths {
+ if fuzzer, ok := mod.compiler.(*fuzzDecorator); ok {
+ return fuzzer.sharedLibraries
+ }
+ panic(fmt.Errorf("FuzzSharedLibraries called on non-fuzz module: %q", mod.BaseModuleName()))
+}
+
func (mod *Module) UnstrippedOutputFile() android.Path {
if mod.compiler != nil {
return mod.compiler.unstrippedOutputFilePath()