Merge "[cc_fuzz] Export DSO symbols to /symbols/data/"
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()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,12 +430,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