[cc_fuzz] Export DSO symbols to /symbols/data/
cc_fuzz reexports transient dependeny DSO's to /data/fuzz through Make. We intentionally export the non-stripped variants so that ClusterFuzz can use the symbolized variant, but we don't re-export to /symbols/data/fuzz. This means that tools like `stack` and `hwasan_symbolize` can't pick up the symbols and don't know what to do. Fix this by re-exporting to /symbols/ as well. Bug: N/A Test: make example_fuzzer && ls $ANDROID_PRODUCT_OUT/symbols/data/fuzz/arm64/lib Change-Id: Id0343c95a0a83e16e6f67f29ff6361fb4d757c05
This commit is contained in:
23
cc/fuzz.go
23
cc/fuzz.go
@@ -198,6 +198,11 @@ func sharedLibraryInstallLocation(
|
|||||||
return installLocation
|
return installLocation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the device-only shared library symbols install directory.
|
||||||
|
func sharedLibrarySymbolsInstallLocation(libraryPath android.Path, archString string) string {
|
||||||
|
return filepath.Join("$(PRODUCT_OUT)/symbols/data/fuzz/", archString, "/lib/", libraryPath.Base())
|
||||||
|
}
|
||||||
|
|
||||||
func (fuzz *fuzzBinary) install(ctx ModuleContext, file android.Path) {
|
func (fuzz *fuzzBinary) install(ctx ModuleContext, file android.Path) {
|
||||||
fuzz.binaryDecorator.baseInstaller.dir = filepath.Join(
|
fuzz.binaryDecorator.baseInstaller.dir = filepath.Join(
|
||||||
"fuzz", ctx.Target().Arch.ArchType.String(), ctx.ModuleName())
|
"fuzz", ctx.Target().Arch.ArchType.String(), ctx.ModuleName())
|
||||||
@@ -269,6 +274,12 @@ func (fuzz *fuzzBinary) install(ctx ModuleContext, file android.Path) {
|
|||||||
fuzz.installedSharedDeps = append(fuzz.installedSharedDeps,
|
fuzz.installedSharedDeps = append(fuzz.installedSharedDeps,
|
||||||
sharedLibraryInstallLocation(
|
sharedLibraryInstallLocation(
|
||||||
lib, ctx.Host(), ctx.Arch().ArchType.String()))
|
lib, ctx.Host(), ctx.Arch().ArchType.String()))
|
||||||
|
|
||||||
|
// Also add the dependency on the shared library symbols dir.
|
||||||
|
if !ctx.Host() {
|
||||||
|
fuzz.installedSharedDeps = append(fuzz.installedSharedDeps,
|
||||||
|
sharedLibrarySymbolsInstallLocation(lib, ctx.Arch().ArchType.String()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -421,12 +432,24 @@ func (s *fuzzPackager) GenerateBuildActions(ctx android.SingletonContext) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
sharedLibraryInstalled[installDestination] = true
|
sharedLibraryInstalled[installDestination] = true
|
||||||
|
|
||||||
// Escape all the variables, as the install destination here will be called
|
// Escape all the variables, as the install destination here will be called
|
||||||
// via. $(eval) in Make.
|
// via. $(eval) in Make.
|
||||||
installDestination = strings.ReplaceAll(
|
installDestination = strings.ReplaceAll(
|
||||||
installDestination, "$", "$$")
|
installDestination, "$", "$$")
|
||||||
s.sharedLibInstallStrings = append(s.sharedLibInstallStrings,
|
s.sharedLibInstallStrings = append(s.sharedLibInstallStrings,
|
||||||
library.String()+":"+installDestination)
|
library.String()+":"+installDestination)
|
||||||
|
|
||||||
|
// Ensure that on device, the library is also reinstalled to the /symbols/
|
||||||
|
// dir. Symbolized DSO's are always installed to the device when fuzzing, but
|
||||||
|
// we want symbolization tools (like `stack`) to be able to find the symbols
|
||||||
|
// in $ANDROID_PRODUCT_OUT/symbols automagically.
|
||||||
|
if !ccModule.Host() {
|
||||||
|
symbolsInstallDestination := sharedLibrarySymbolsInstallLocation(library, archString)
|
||||||
|
symbolsInstallDestination = strings.ReplaceAll(symbolsInstallDestination, "$", "$$")
|
||||||
|
s.sharedLibInstallStrings = append(s.sharedLibInstallStrings,
|
||||||
|
library.String()+":"+symbolsInstallDestination)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The executable.
|
// The executable.
|
||||||
|
Reference in New Issue
Block a user