Merge "Revert "Support enabling overflow sanitization by path.""
diff --git a/OWNERS b/OWNERS
index 004d638..c0c3762 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,7 +1,9 @@
ccross@android.com
dwillemsen@google.com
+nanzhang@google.com
per-file * = ccross@android.com
per-file * = dwillemsen@google.com
+per-file * = nanzhang@google.com
per-file *gen_stub_libs.py = danalbert@google.com
per-file ndk_*.go = danalbert@google.com
diff --git a/cc/builder.go b/cc/builder.go
index db4cb4f..1e1c4f2 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -187,12 +187,12 @@
sAbiLink = pctx.AndroidStaticRule("sAbiLink",
blueprint.RuleParams{
- Command: "$sAbiLinker -o ${out} $symbolFilter -arch $arch -api $api $exportedHeaderFlags @${out}.rsp ",
+ Command: "$sAbiLinker -o ${out} $symbolFilter -arch $arch $exportedHeaderFlags @${out}.rsp ",
CommandDeps: []string{"$sAbiLinker"},
Rspfile: "${out}.rsp",
RspfileContent: "${in}",
},
- "symbolFilter", "arch", "api", "exportedHeaderFlags")
+ "symbolFilter", "arch", "exportedHeaderFlags")
_ = pctx.SourcePathVariable("sAbiDiffer", "prebuilts/build-tools/${config.HostPrebuiltTag}/bin/header-abi-diff")
@@ -681,27 +681,18 @@
// Generate a rule to combine .dump sAbi dump files from multiple source files
// into a single .ldump sAbi dump file
func TransformDumpToLinkedDump(ctx android.ModuleContext, sAbiDumps android.Paths, soFile android.Path,
- symbolFile android.OptionalPath, apiLevel, baseName, exportedHeaderFlags string) android.OptionalPath {
+ baseName, exportedHeaderFlags string) android.OptionalPath {
outputFile := android.PathForModuleOut(ctx, baseName+".lsdump")
- var symbolFilterStr string
- var linkedDumpDep android.Path
- if symbolFile.Valid() {
- symbolFilterStr = "-v " + symbolFile.Path().String()
- linkedDumpDep = symbolFile.Path()
- } else {
- linkedDumpDep = soFile
- symbolFilterStr = "-so " + soFile.String()
- }
+ symbolFilterStr := "-so " + soFile.String()
ctx.Build(pctx, android.BuildParams{
Rule: sAbiLink,
Description: "header-abi-linker " + outputFile.Base(),
Output: outputFile,
Inputs: sAbiDumps,
- Implicit: linkedDumpDep,
+ Implicit: soFile,
Args: map[string]string{
- "symbolFilter": symbolFilterStr,
- "arch": ctx.Arch().ArchType.Name,
- "api": apiLevel,
+ "symbolFilter": symbolFilterStr,
+ "arch": ctx.Arch().ArchType.Name,
"exportedHeaderFlags": exportedHeaderFlags,
},
})
@@ -720,8 +711,12 @@
}
func SourceAbiDiff(ctx android.ModuleContext, inputDump android.Path, referenceDump android.Path,
- baseName string) android.OptionalPath {
+ baseName, exportedHeaderFlags string) android.OptionalPath {
outputFile := android.PathForModuleOut(ctx, baseName+".abidiff")
+ localAbiCheckAllowFlags := append([]string(nil), abiCheckAllowFlags...)
+ if exportedHeaderFlags == "" {
+ localAbiCheckAllowFlags = append(localAbiCheckAllowFlags, "-advice-only")
+ }
ctx.Build(pctx, android.BuildParams{
Rule: sAbiDiff,
Description: "header-abi-diff " + outputFile.Base(),
@@ -732,7 +727,7 @@
"referenceDump": referenceDump.String(),
"libName": baseName,
"arch": ctx.Arch().ArchType.Name,
- "allowFlags": strings.Join(abiCheckAllowFlags, " "),
+ "allowFlags": strings.Join(localAbiCheckAllowFlags, " "),
},
})
return android.OptionalPathForPath(outputFile)
diff --git a/cc/cc.go b/cc/cc.go
index e5a483d..a3af304 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1442,12 +1442,17 @@
mod := mctx.CreateVariations(vendorMode)
vendor := mod[0].(*Module)
vendor.Properties.UseVndk = true
- } else if _, ok := m.linker.(*vndkPrebuiltLibraryDecorator); ok {
+ } else if prebuilt, ok := m.linker.(*vndkPrebuiltLibraryDecorator); ok {
// Make vendor variants only for the versions in BOARD_VNDK_VERSION and
// PRODUCT_EXTRA_VNDK_VERSIONS.
mod := mctx.CreateVariations(vendorMode)
vendor := mod[0].(*Module)
vendor.Properties.UseVndk = true
+ arches := mctx.DeviceConfig().Arches()
+ if len(arches) == 0 || arches[0].ArchType.String() != prebuilt.arch() {
+ vendor.Properties.PreventInstall = true
+ vendor.Properties.HideFromMake = true
+ }
} else if m.hasVendorVariant() {
// This will be available in both /system and /vendor
// or a /system directory that is available to vendor.
diff --git a/cc/config/global.go b/cc/config/global.go
index ef710c8..5e99cde 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -112,7 +112,7 @@
ExperimentalCStdVersion = "gnu11"
ExperimentalCppStdVersion = "gnu++1z"
- NdkMaxPrebuiltVersionInt = 24
+ NdkMaxPrebuiltVersionInt = 27
// prebuilts/clang default settings.
ClangDefaultBase = "prebuilts/clang/host"
diff --git a/cc/library.go b/cc/library.go
index 4a900ef..0ed1848 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -620,11 +620,6 @@
//Also take into account object re-use.
if len(objs.sAbiDumpFiles) > 0 && ctx.createVndkSourceAbiDump() {
refSourceDumpFile := android.PathForVndkRefAbiDump(ctx, "current", fileName, vndkVsNdk(ctx), true)
- versionScript := android.OptionalPathForModuleSrc(ctx, library.Properties.Version_script)
- var symbolFile android.OptionalPath
- if versionScript.Valid() {
- symbolFile = versionScript
- }
exportIncludeDirs := library.flagExporter.exportedIncludes(ctx)
var SourceAbiFlags []string
for _, dir := range exportIncludeDirs.Strings() {
@@ -634,10 +629,10 @@
SourceAbiFlags = append(SourceAbiFlags, reexportedInclude)
}
exportedHeaderFlags := strings.Join(SourceAbiFlags, " ")
- library.sAbiOutputFile = TransformDumpToLinkedDump(ctx, objs.sAbiDumpFiles, soFile, symbolFile, "current", fileName, exportedHeaderFlags)
+ library.sAbiOutputFile = TransformDumpToLinkedDump(ctx, objs.sAbiDumpFiles, soFile, fileName, exportedHeaderFlags)
if refSourceDumpFile.Valid() {
unzippedRefDump := UnzipRefDump(ctx, refSourceDumpFile.Path(), fileName)
- library.sAbiDiff = SourceAbiDiff(ctx, library.sAbiOutputFile.Path(), unzippedRefDump, fileName)
+ library.sAbiDiff = SourceAbiDiff(ctx, library.sAbiOutputFile.Path(), unzippedRefDump, fileName, exportedHeaderFlags)
}
}
}
diff --git a/cc/pgo.go b/cc/pgo.go
index fef962e..7ac5b2a 100644
--- a/cc/pgo.go
+++ b/cc/pgo.go
@@ -26,9 +26,12 @@
// Add flags to ignore warnings that profiles are old or missing for
// some functions
profileUseOtherFlags = []string{"-Wno-backend-plugin"}
-)
-const pgoProfileProject = "toolchain/pgo-profiles"
+ pgoProfileProjects = []string{
+ "toolchain/pgo-profiles",
+ "vendor/google_data/pgo-profiles",
+ }
+)
const profileInstrumentFlag = "-fprofile-generate=/data/local/tmp"
const profileSamplingFlag = "-gline-tables-only"
@@ -84,6 +87,18 @@
return flags
}
+func (props *PgoProperties) getPgoProfileFile(ctx ModuleContext) android.OptionalPath {
+ // Test if the profile_file is present in any of the pgoProfileProjects
+ for _, profileProject := range pgoProfileProjects {
+ path := android.ExistentPathForSource(ctx, "", profileProject, *props.Pgo.Profile_file)
+ if path.Valid() {
+ return path
+ }
+ }
+
+ return android.OptionalPathForPath(nil)
+}
+
func (props *PgoProperties) profileUseFlag(ctx ModuleContext, file string) string {
if props.isInstrumentation() {
return fmt.Sprintf(profileUseInstrumentFormat, file)
@@ -101,24 +116,28 @@
}
func (props *PgoProperties) addProfileUseFlags(ctx ModuleContext, flags Flags) Flags {
+ // Return if 'pgo' property is not present in this module.
+ if !props.PgoPresent {
+ return flags
+ }
+
// Skip -fprofile-use if 'enable_profile_use' property is set
if props.Pgo.Enable_profile_use != nil && *props.Pgo.Enable_profile_use == false {
return flags
}
- // If the PGO profiles project is found, and this module has PGO
- // enabled, add flags to use the profile
- if profilesDir := getPgoProfilesDir(ctx); props.PgoPresent && profilesDir.Valid() {
- profileFile := android.PathForSource(ctx, profilesDir.String(), *props.Pgo.Profile_file)
- profileUseFlags := props.profileUseFlags(ctx, profileFile.String())
+ // If the profile file is found, add flags to use the profile
+ if profileFile := props.getPgoProfileFile(ctx); profileFile.Valid() {
+ profileFilePath := profileFile.Path()
+ profileUseFlags := props.profileUseFlags(ctx, profileFilePath.String())
flags.CFlags = append(flags.CFlags, profileUseFlags...)
flags.LdFlags = append(flags.LdFlags, profileUseFlags...)
// Update CFlagsDeps and LdFlagsDeps so the module is rebuilt
// if profileFile gets updated
- flags.CFlagsDeps = append(flags.CFlagsDeps, profileFile)
- flags.LdFlagsDeps = append(flags.LdFlagsDeps, profileFile)
+ flags.CFlagsDeps = append(flags.CFlagsDeps, profileFilePath)
+ flags.LdFlagsDeps = append(flags.LdFlagsDeps, profileFilePath)
}
return flags
}
@@ -164,10 +183,6 @@
return true
}
-func getPgoProfilesDir(ctx ModuleContext) android.OptionalPath {
- return android.ExistentPathForSource(ctx, "", pgoProfileProject)
-}
-
func (pgo *pgo) begin(ctx BaseModuleContext) {
// TODO Evaluate if we need to support PGO for host modules
if ctx.Host() {
diff --git a/cc/vndk_prebuilt.go b/cc/vndk_prebuilt.go
index b4fcb57..99e35f3 100644
--- a/cc/vndk_prebuilt.go
+++ b/cc/vndk_prebuilt.go
@@ -111,12 +111,10 @@
func (p *vndkPrebuiltLibraryDecorator) install(ctx ModuleContext, file android.Path) {
if p.shared() {
- if ctx.Device() && ctx.useVndk() {
- if ctx.isVndkSp() {
- p.baseInstaller.subDir = "vndk-sp-" + p.version()
- } else if ctx.isVndk() {
- p.baseInstaller.subDir = "vndk-" + p.version()
- }
+ if ctx.isVndkSp() {
+ p.baseInstaller.subDir = "vndk-sp-" + p.version()
+ } else if ctx.isVndk() {
+ p.baseInstaller.subDir = "vndk-" + p.version()
}
p.baseInstaller.install(ctx, file)
}
diff --git a/java/java.go b/java/java.go
index 8f58c6e..94ec85e 100644
--- a/java/java.go
+++ b/java/java.go
@@ -347,7 +347,7 @@
if strings.Contains(v, "system_") {
return sdkDep{
invalidVersion: true,
- module: "vsdk_v" + strings.Replace(v, "system_", "", 1),
+ module: "system_sdk_v" + strings.Replace(v, "system_", "", 1),
}
}
return sdkDep{