Merge "[cc_fuzz] Export DSO symbols to /symbols/data/"
This commit is contained in:
commit
49bd9cc371
1 changed files with 23 additions and 0 deletions
23
cc/fuzz.go
23
cc/fuzz.go
|
@ -198,6 +198,11 @@ func sharedLibraryInstallLocation(
|
|||
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) {
|
||||
fuzz.binaryDecorator.baseInstaller.dir = filepath.Join(
|
||||
"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,
|
||||
sharedLibraryInstallLocation(
|
||||
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()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -419,12 +430,24 @@ func (s *fuzzPackager) GenerateBuildActions(ctx android.SingletonContext) {
|
|||
continue
|
||||
}
|
||||
sharedLibraryInstalled[installDestination] = true
|
||||
|
||||
// Escape all the variables, as the install destination here will be called
|
||||
// via. $(eval) in Make.
|
||||
installDestination = strings.ReplaceAll(
|
||||
installDestination, "$", "$$")
|
||||
s.sharedLibInstallStrings = append(s.sharedLibInstallStrings,
|
||||
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.
|
||||
|
|
Loading…
Reference in a new issue