summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android/package_ctx.go6
-rw-r--r--android/paths.go68
-rw-r--r--cc/config/arm64_device.go5
-rw-r--r--cc/config/arm_device.go23
-rw-r--r--cc/config/global.go6
5 files changed, 63 insertions, 45 deletions
diff --git a/android/package_ctx.go b/android/package_ctx.go
index d9bb10900..530440392 100644
--- a/android/package_ctx.go
+++ b/android/package_ctx.go
@@ -120,16 +120,16 @@ func (p AndroidPackageContext) IntermediatesPathVariable(name, path string) blue
})
}
-// PrefixedPathsForOptionalSourceVariable returns a Variable whose value is the
+// PrefixedExistentPathsForSourcesVariable returns a Variable whose value is the
// list of present source paths prefixed with the supplied prefix. It may only
// be called during a Go package's initialization - either from the init()
// function or as part of a package-scoped variable's initialization.
-func (p AndroidPackageContext) PrefixedPathsForOptionalSourceVariable(
+func (p AndroidPackageContext) PrefixedExistentPathsForSourcesVariable(
name, prefix string, paths []string) blueprint.Variable {
return p.VariableFunc(name, func(config interface{}) (string, error) {
ctx := &configErrorWrapper{p, config.(Config), []error{}}
- paths := PathsForOptionalSource(ctx, "", paths)
+ paths := ExistentPathsForSources(ctx, "", paths)
if len(ctx.errors) > 0 {
return "", ctx.errors[0]
}
diff --git a/android/paths.go b/android/paths.go
index 0d26dc02c..a23dd74e2 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -97,6 +97,8 @@ type Path interface {
type WritablePath interface {
Path
+ // the writablePath method doesn't directly do anything,
+ // but it allows a struct to distinguish between whether or not it implements the WritablePath interface
writablePath()
}
@@ -137,7 +139,7 @@ func ResPathWithName(ctx ModuleContext, p Path, name string) ModuleResPath {
if path, ok := p.(resPathProvider); ok {
return path.resPathWithName(ctx, name)
}
- reportPathError(ctx, "Tried to create object file from unsupported path: %s (%s)", reflect.TypeOf(p).Name(), p)
+ reportPathError(ctx, "Tried to create res file from unsupported path: %s (%s)", reflect.TypeOf(p).Name(), p)
return PathForModuleRes(ctx)
}
@@ -188,7 +190,7 @@ func PathsForSource(ctx PathContext, paths []string) Paths {
ret := make(Paths, 0, len(paths))
intermediates := filepath.Join(modCtx.ModuleDir(), modCtx.ModuleName(), modCtx.ModuleSubDir(), "missing")
for _, path := range paths {
- p := OptionalPathForSource(ctx, intermediates, path)
+ p := ExistentPathForSource(ctx, intermediates, path)
if p.Valid() {
ret = append(ret, p.Path())
} else {
@@ -205,13 +207,13 @@ func PathsForSource(ctx PathContext, paths []string) Paths {
return ret
}
-// PathsForOptionalSource returns a list of Paths rooted from SrcDir that are
+// ExistentPathsForSources returns a list of Paths rooted from SrcDir that are
// found in the tree. If any are not found, they are omitted from the list,
// and dependencies are added so that we're re-run when they are added.
-func PathsForOptionalSource(ctx PathContext, intermediates string, paths []string) Paths {
+func ExistentPathsForSources(ctx PathContext, intermediates string, paths []string) Paths {
ret := make(Paths, 0, len(paths))
for _, path := range paths {
- p := OptionalPathForSource(ctx, intermediates, path)
+ p := ExistentPathForSource(ctx, intermediates, path)
if p.Valid() {
ret = append(ret, p.Path())
}
@@ -337,12 +339,11 @@ func safePathForSource(ctx PathContext, path string) SourcePath {
return ret
}
-// PathForSource returns a SourcePath for the provided paths... (which are
-// joined together with filepath.Join). This also validates that the path
-// doesn't escape the source dir, or is contained in the build dir. On error, it
-// will return a usable, but invalid SourcePath, and report a ModuleError.
-func PathForSource(ctx PathContext, paths ...string) SourcePath {
- p := validatePath(ctx, paths...)
+// PathForSource joins the provided path components and validates that the result
+// neither escapes the source dir nor is in the out dir.
+// On error, it will return a usable, but invalid SourcePath, and report a ModuleError.
+func PathForSource(ctx PathContext, pathComponents ...string) SourcePath {
+ p := validatePath(ctx, pathComponents...)
ret := SourcePath{basePath{p, pathConfig(ctx), ""}}
abs, err := filepath.Abs(ret.String())
@@ -368,16 +369,16 @@ func PathForSource(ctx PathContext, paths ...string) SourcePath {
return ret
}
-// OptionalPathForSource returns an OptionalPath with the SourcePath if the
+// ExistentPathForSource returns an OptionalPath with the SourcePath if the
// path exists, or an empty OptionalPath if it doesn't exist. Dependencies are added
// so that the ninja file will be regenerated if the state of the path changes.
-func OptionalPathForSource(ctx PathContext, intermediates string, paths ...string) OptionalPath {
- if len(paths) == 0 {
+func ExistentPathForSource(ctx PathContext, intermediates string, pathComponents ...string) OptionalPath {
+ if len(pathComponents) == 0 {
// For when someone forgets the 'intermediates' argument
panic("Missing path(s)")
}
- p := validatePath(ctx, paths...)
+ p := validatePath(ctx, pathComponents...)
path := SourcePath{basePath{p, pathConfig(ctx), ""}}
abs, err := filepath.Abs(path.String())
@@ -483,12 +484,11 @@ type OutputPath struct {
var _ Path = OutputPath{}
-// PathForOutput returns an OutputPath for the provided paths... (which are
-// joined together with filepath.Join). This also validates that the path
-// does not escape the build dir. On error, it will return a usable, but invalid
-// OutputPath, and report a ModuleError.
-func PathForOutput(ctx PathContext, paths ...string) OutputPath {
- path := validatePath(ctx, paths...)
+// PathForOutput joins the provided paths and returns an OutputPath that is
+// validated to not escape the build dir.
+// On error, it will return a usable, but invalid OutputPath, and report a ModuleError.
+func PathForOutput(ctx PathContext, pathComponents ...string) OutputPath {
+ path := validatePath(ctx, pathComponents...)
return OutputPath{basePath{path, pathConfig(ctx), ""}}
}
@@ -597,7 +597,7 @@ func PathForVndkRefAbiDump(ctx ModuleContext, version, fileName string, vndkOrNd
}
refDumpFileStr := "prebuilts/abi-dumps/" + vndkOrNdkDir + "/" + version + "/" +
archName + "/" + sourceOrBinaryDir + "/" + fileName + ext
- return OptionalPathForSource(ctx, "", refDumpFileStr)
+ return ExistentPathForSource(ctx, "", refDumpFileStr)
}
// PathForModuleOut returns a Path representing the paths... under the module's
@@ -647,8 +647,8 @@ var _ Path = ModuleObjPath{}
// PathForModuleObj returns a Path representing the paths... under the module's
// 'obj' directory.
-func PathForModuleObj(ctx ModuleContext, paths ...string) ModuleObjPath {
- p := validatePath(ctx, paths...)
+func PathForModuleObj(ctx ModuleContext, pathComponents ...string) ModuleObjPath {
+ p := validatePath(ctx, pathComponents...)
return ModuleObjPath{PathForModuleOut(ctx, "obj", p)}
}
@@ -662,14 +662,14 @@ var _ Path = ModuleResPath{}
// PathForModuleRes returns a Path representing the paths... under the module's
// 'res' directory.
-func PathForModuleRes(ctx ModuleContext, paths ...string) ModuleResPath {
- p := validatePath(ctx, paths...)
+func PathForModuleRes(ctx ModuleContext, pathComponents ...string) ModuleResPath {
+ p := validatePath(ctx, pathComponents...)
return ModuleResPath{PathForModuleOut(ctx, "res", p)}
}
// PathForModuleInstall returns a Path representing the install path for the
// module appended with paths...
-func PathForModuleInstall(ctx ModuleContext, paths ...string) OutputPath {
+func PathForModuleInstall(ctx ModuleContext, pathComponents ...string) OutputPath {
var outPaths []string
if ctx.Device() {
partition := "system"
@@ -689,14 +689,14 @@ func PathForModuleInstall(ctx ModuleContext, paths ...string) OutputPath {
if ctx.Debug() {
outPaths = append([]string{"debug"}, outPaths...)
}
- outPaths = append(outPaths, paths...)
+ outPaths = append(outPaths, pathComponents...)
return PathForOutput(ctx, outPaths...)
}
// validateSafePath validates a path that we trust (may contain ninja variables).
// Ensures that each path component does not attempt to leave its component.
-func validateSafePath(ctx PathContext, paths ...string) string {
- for _, path := range paths {
+func validateSafePath(ctx PathContext, pathComponents ...string) string {
+ for _, path := range pathComponents {
path := filepath.Clean(path)
if path == ".." || strings.HasPrefix(path, "../") || strings.HasPrefix(path, "/") {
reportPathError(ctx, "Path is outside directory: %s", path)
@@ -706,20 +706,20 @@ func validateSafePath(ctx PathContext, paths ...string) string {
// TODO: filepath.Join isn't necessarily correct with embedded ninja
// variables. '..' may remove the entire ninja variable, even if it
// will be expanded to multiple nested directories.
- return filepath.Join(paths...)
+ return filepath.Join(pathComponents...)
}
// validatePath validates that a path does not include ninja variables, and that
// each path component does not attempt to leave its component. Returns a joined
// version of each path component.
-func validatePath(ctx PathContext, paths ...string) string {
- for _, path := range paths {
+func validatePath(ctx PathContext, pathComponents ...string) string {
+ for _, path := range pathComponents {
if strings.Contains(path, "$") {
reportPathError(ctx, "Path contains invalid character($): %s", path)
return ""
}
}
- return validateSafePath(ctx, paths...)
+ return validateSafePath(ctx, pathComponents...)
}
type testPath struct {
diff --git a/cc/config/arm64_device.go b/cc/config/arm64_device.go
index f387ddfb6..a371cf69b 100644
--- a/cc/config/arm64_device.go
+++ b/cc/config/arm64_device.go
@@ -93,7 +93,8 @@ const (
func init() {
android.RegisterArchVariants(android.Arm64,
"armv8_a",
- "cortex_a53",
+ "cortex-a53",
+ "cortex-a73",
"kryo",
"denver64")
@@ -129,12 +130,14 @@ var (
arm64CpuVariantCflagsVar = map[string]string{
"": "",
"cortex-a53": "${config.Arm64CortexA53Cflags}",
+ "cortex-a73": "${config.Arm64CortexA53Cflags}",
"kryo": "${config.Arm64KryoCflags}",
}
arm64ClangCpuVariantCflagsVar = map[string]string{
"": "",
"cortex-a53": "${config.Arm64ClangCortexA53Cflags}",
+ "cortex-a73": "${config.Arm64ClangCortexA53Cflags}",
"kryo": "${config.Arm64ClangKryoCflags}",
}
)
diff --git a/cc/config/arm_device.go b/cc/config/arm_device.go
index 94627e7dc..ee9e042b4 100644
--- a/cc/config/arm_device.go
+++ b/cc/config/arm_device.go
@@ -127,6 +127,15 @@ var (
// better solution comes around. See Bug 27340895
"-D__ARM_FEATURE_LPAE=1",
},
+ "cortex-a53": []string{
+ "-mcpu=cortex-a53",
+ "-mfpu=neon-fp-armv8",
+ // Fake an ARM compiler flag as these processors support LPAE which GCC/clang
+ // don't advertise.
+ // TODO This is a hack and we need to add it for each processor that supports LPAE until some
+ // better solution comes around. See Bug 27340895
+ "-D__ARM_FEATURE_LPAE=1",
+ },
"krait": []string{
"-mcpu=cortex-a15",
"-mfpu=neon-vfpv4",
@@ -169,6 +178,7 @@ func init() {
"cortex-a15",
"cortex-a53",
"cortex-a53-a57",
+ "cortex-a73",
"krait",
"kryo",
"denver")
@@ -207,6 +217,7 @@ func init() {
pctx.StaticVariable("ArmCortexA7Cflags", strings.Join(armCpuVariantCflags["cortex-a7"], " "))
pctx.StaticVariable("ArmCortexA8Cflags", strings.Join(armCpuVariantCflags["cortex-a8"], " "))
pctx.StaticVariable("ArmCortexA15Cflags", strings.Join(armCpuVariantCflags["cortex-a15"], " "))
+ pctx.StaticVariable("ArmCortexA53Cflags", strings.Join(armCpuVariantCflags["cortex-a53"], " "))
pctx.StaticVariable("ArmKraitCflags", strings.Join(armCpuVariantCflags["krait"], " "))
pctx.StaticVariable("ArmKryoCflags", strings.Join(armCpuVariantCflags["kryo"], " "))
@@ -237,6 +248,8 @@ func init() {
strings.Join(armClangCpuVariantCflags["cortex-a8"], " "))
pctx.StaticVariable("ArmClangCortexA15Cflags",
strings.Join(armClangCpuVariantCflags["cortex-a15"], " "))
+ pctx.StaticVariable("ArmClangCortexA53Cflags",
+ strings.Join(armClangCpuVariantCflags["cortex-a53"], " "))
pctx.StaticVariable("ArmClangKraitCflags",
strings.Join(armClangCpuVariantCflags["krait"], " "))
pctx.StaticVariable("ArmClangKryoCflags",
@@ -255,8 +268,9 @@ var (
"cortex-a7": "${config.ArmCortexA7Cflags}",
"cortex-a8": "${config.ArmCortexA8Cflags}",
"cortex-a15": "${config.ArmCortexA15Cflags}",
- "cortex-a53": "${config.ArmCortexA7Cflags}",
- "cortex-a53.a57": "${config.ArmCortexA7Cflags}",
+ "cortex-a53": "${config.ArmCortexA53Cflags}",
+ "cortex-a53.a57": "${config.ArmCortexA53Cflags}",
+ "cortex-a73": "${config.ArmCortexA53Cflags}",
"krait": "${config.ArmKraitCflags}",
"kryo": "${config.ArmKryoCflags}",
"denver": "${config.ArmCortexA15Cflags}",
@@ -273,8 +287,9 @@ var (
"cortex-a7": "${config.ArmClangCortexA7Cflags}",
"cortex-a8": "${config.ArmClangCortexA8Cflags}",
"cortex-a15": "${config.ArmClangCortexA15Cflags}",
- "cortex-a53": "${config.ArmClangCortexA7Cflags}",
- "cortex-a53.a57": "${config.ArmClangCortexA7Cflags}",
+ "cortex-a53": "${config.ArmClangCortexA53Cflags}",
+ "cortex-a53.a57": "${config.ArmClangCortexA53Cflags}",
+ "cortex-a73": "${config.ArmClangCortexA53Cflags}",
"krait": "${config.ArmClangKraitCflags}",
"kryo": "${config.ArmClangKryoCflags}",
"denver": "${config.ArmClangCortexA15Cflags}",
diff --git a/cc/config/global.go b/cc/config/global.go
index a29afec63..997256efe 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -104,7 +104,7 @@ func init() {
// Everything in these lists is a crime against abstraction and dependency tracking.
// Do not add anything to this list.
- pctx.PrefixedPathsForOptionalSourceVariable("CommonGlobalIncludes", "-I",
+ pctx.PrefixedExistentPathsForSourcesVariable("CommonGlobalIncludes", "-I",
[]string{
"system/core/include",
"system/media/audio/include",
@@ -118,7 +118,7 @@ func init() {
})
// This is used by non-NDK modules to get jni.h. export_include_dirs doesn't help
// with this, since there is no associated library.
- pctx.PrefixedPathsForOptionalSourceVariable("CommonNativehelperInclude", "-I",
+ pctx.PrefixedExistentPathsForSourcesVariable("CommonNativehelperInclude", "-I",
[]string{"libnativehelper/include/nativehelper"})
pctx.SourcePathVariable("ClangDefaultBase", "prebuilts/clang/host")
@@ -153,7 +153,7 @@ func init() {
pctx.StaticVariable("RSLLVMPrebuiltsPath", "${RSClangBase}/${HostPrebuiltTag}/${RSClangVersion}/bin")
pctx.StaticVariable("RSIncludePath", "${RSLLVMPrebuiltsPath}/../lib64/clang/${RSReleaseVersion}/include")
- pctx.PrefixedPathsForOptionalSourceVariable("RsGlobalIncludes", "-I",
+ pctx.PrefixedExistentPathsForSourcesVariable("RsGlobalIncludes", "-I",
[]string{
"external/clang/lib/Headers",
"frameworks/rs/script_api/include",