Merge "Added functionality in soong_zip that supports adding root prefix."
diff --git a/android/androidmk.go b/android/androidmk.go
index ec3abe1..d55cdca 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -232,6 +232,9 @@
if amod.commonProperties.Proprietary {
fmt.Fprintln(w, "LOCAL_PROPRIETARY_MODULE := true")
}
+ if amod.commonProperties.Owner != "" {
+ fmt.Fprintln(w, "LOCAL_MODULE_OWNER :=", amod.commonProperties.Owner)
+ }
}
if host {
diff --git a/android/config.go b/android/config.go
index bc76f34..2361920 100644
--- a/android/config.go
+++ b/android/config.go
@@ -439,7 +439,7 @@
default:
return "0x70000000"
case Mips, Mips64:
- return "0x30000000"
+ return "0x64000000"
}
}
diff --git a/android/module.go b/android/module.go
index 6474e47..cc420fb 100644
--- a/android/module.go
+++ b/android/module.go
@@ -137,6 +137,9 @@
// whether this is a proprietary vendor module, and should be installed into /vendor
Proprietary bool
+ // vendor who owns this module
+ Owner string
+
// *.logtags files, to combine together in order to generate the /system/etc/event-log-tags
// file
Logtags []string
diff --git a/android/prebuilt.go b/android/prebuilt.go
index 006b66f..772df7a 100644
--- a/android/prebuilt.go
+++ b/android/prebuilt.go
@@ -76,10 +76,15 @@
}
}
-// PrebuiltSelectModuleMutator marks prebuilts that are overriding source modules, and disables
-// installing the source module.
+// PrebuiltSelectModuleMutator marks prebuilts that are used, either overriding source modules or
+// because the source module doesn't exist. It also disables installing overridden source modules.
func PrebuiltSelectModuleMutator(ctx TopDownMutatorContext) {
- if s, ok := ctx.Module().(Module); ok {
+ if m, ok := ctx.Module().(PrebuiltInterface); ok && m.Prebuilt() != nil {
+ p := m.Prebuilt()
+ if !p.Properties.SourceExists {
+ p.Properties.UsePrebuilt = p.usePrebuilt(ctx, nil)
+ }
+ } else if s, ok := ctx.Module().(Module); ok {
ctx.VisitDirectDeps(func(m blueprint.Module) {
if ctx.OtherModuleDependencyTag(m) == prebuiltDepTag {
p := m.(PrebuiltInterface).Prebuilt()
@@ -121,5 +126,5 @@
return true
}
- return !source.Enabled()
+ return source == nil || !source.Enabled()
}
diff --git a/android/prebuilt_test.go b/android/prebuilt_test.go
index 311f821..d09518b 100644
--- a/android/prebuilt_test.go
+++ b/android/prebuilt_test.go
@@ -144,20 +144,33 @@
t.Fatalf("failed to find module foo")
}
+ var dependsOnSourceModule, dependsOnPrebuiltModule bool
+ ctx.VisitDirectDeps(foo, func(m blueprint.Module) {
+ if _, ok := m.(*sourceModule); ok {
+ dependsOnSourceModule = true
+ }
+ if p, ok := m.(*prebuiltModule); ok {
+ dependsOnPrebuiltModule = true
+ if !p.Prebuilt().Properties.UsePrebuilt {
+ t.Errorf("dependency on prebuilt module not marked used")
+ }
+ }
+ })
+
if test.prebuilt {
- if !foo.(*sourceModule).dependsOnPrebuiltModule {
+ if !dependsOnPrebuiltModule {
t.Errorf("doesn't depend on prebuilt module")
}
- if foo.(*sourceModule).dependsOnSourceModule {
+ if dependsOnSourceModule {
t.Errorf("depends on source module")
}
} else {
- if foo.(*sourceModule).dependsOnPrebuiltModule {
+ if dependsOnPrebuiltModule {
t.Errorf("depends on prebuilt module")
}
- if !foo.(*sourceModule).dependsOnSourceModule {
+ if !dependsOnSourceModule {
t.Errorf("doens't depend on source module")
}
}
@@ -209,14 +222,6 @@
}
func (s *sourceModule) GenerateAndroidBuildActions(ctx ModuleContext) {
- ctx.VisitDirectDeps(func(m blueprint.Module) {
- if _, ok := m.(*sourceModule); ok {
- s.dependsOnSourceModule = true
- }
- if _, ok := m.(*prebuiltModule); ok {
- s.dependsOnPrebuiltModule = true
- }
- })
}
func findModule(ctx *blueprint.Context, name string) blueprint.Module {
diff --git a/androidmk/cmd/androidmk/android.go b/androidmk/cmd/androidmk/android.go
index 8d46a78..75c3eec 100644
--- a/androidmk/cmd/androidmk/android.go
+++ b/androidmk/cmd/androidmk/android.go
@@ -68,6 +68,7 @@
"LOCAL_MODULE_RELATIVE_PATH": "relative_install_path",
"LOCAL_PROTOC_OPTIMIZE_TYPE": "proto.type",
"LOCAL_HEADER_LIBRARIES": "header_libs",
+ "LOCAL_MODULE_OWNER": "owner",
})
addStandardProperties(bpparser.ListType,
map[string]string{
diff --git a/cc/prebuilt.go b/cc/prebuilt.go
index abe03b9..08ba145 100644
--- a/cc/prebuilt.go
+++ b/cc/prebuilt.go
@@ -21,7 +21,9 @@
)
func init() {
- android.RegisterModuleType("cc_prebuilt_shared_library", prebuiltSharedLibraryFactory)
+ android.RegisterModuleType("cc_prebuilt_library_shared", prebuiltSharedLibraryFactory)
+ android.RegisterModuleType("cc_prebuilt_library_static", prebuiltStaticLibraryFactory)
+ android.RegisterModuleType("cc_prebuilt_binary", prebuiltBinaryFactory)
}
type prebuiltLinkerInterface interface {
@@ -29,17 +31,21 @@
prebuilt() *android.Prebuilt
}
-type prebuiltLibraryLinker struct {
- *libraryDecorator
+type prebuiltLinker struct {
android.Prebuilt
}
-var _ prebuiltLinkerInterface = (*prebuiltLibraryLinker)(nil)
-
-func (p *prebuiltLibraryLinker) prebuilt() *android.Prebuilt {
+func (p *prebuiltLinker) prebuilt() *android.Prebuilt {
return &p.Prebuilt
}
+type prebuiltLibraryLinker struct {
+ *libraryDecorator
+ prebuiltLinker
+}
+
+var _ prebuiltLinkerInterface = (*prebuiltLibraryLinker)(nil)
+
func (p *prebuiltLibraryLinker) linkerProps() []interface{} {
props := p.libraryDecorator.linkerProps()
return append(props, &p.Prebuilt.Properties)
@@ -61,13 +67,61 @@
func prebuiltSharedLibraryFactory() (blueprint.Module, []interface{}) {
module, library := NewLibrary(android.HostAndDeviceSupported)
+ library.BuildOnlyShared()
module.compiler = nil
prebuilt := &prebuiltLibraryLinker{
libraryDecorator: library,
}
module.linker = prebuilt
- module.installer = prebuilt
+
+ return module.Init()
+}
+
+func prebuiltStaticLibraryFactory() (blueprint.Module, []interface{}) {
+ module, library := NewLibrary(android.HostAndDeviceSupported)
+ library.BuildOnlyStatic()
+ module.compiler = nil
+
+ prebuilt := &prebuiltLibraryLinker{
+ libraryDecorator: library,
+ }
+ module.linker = prebuilt
+
+ return module.Init()
+}
+
+type prebuiltBinaryLinker struct {
+ *binaryDecorator
+ prebuiltLinker
+}
+
+var _ prebuiltLinkerInterface = (*prebuiltBinaryLinker)(nil)
+
+func (p *prebuiltBinaryLinker) linkerProps() []interface{} {
+ props := p.binaryDecorator.linkerProps()
+ return append(props, &p.Prebuilt.Properties)
+}
+
+func (p *prebuiltBinaryLinker) link(ctx ModuleContext,
+ flags Flags, deps PathDeps, objs Objects) android.Path {
+ // TODO(ccross): verify shared library dependencies
+ if len(p.Prebuilt.Properties.Srcs) > 0 {
+ // TODO(ccross): .toc optimization, stripping, packing
+ return p.Prebuilt.Path(ctx)
+ }
+
+ return nil
+}
+
+func prebuiltBinaryFactory() (blueprint.Module, []interface{}) {
+ module, binary := NewBinary(android.HostAndDeviceSupported)
+ module.compiler = nil
+
+ prebuilt := &prebuiltBinaryLinker{
+ binaryDecorator: binary,
+ }
+ module.linker = prebuilt
return module.Init()
}
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 28c6ef5..bccd28d 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -34,6 +34,7 @@
// FIXME: revert the __cfi_check flag when clang is updated to r280031.
cfiLdflags = "-flto -fsanitize-cfi-cross-dso -fsanitize=cfi " +
"-Wl,-plugin-opt,O1 -Wl,-export-dynamic-symbol=__cfi_check"
+ cfiArflags = "--plugin ${config.ClangBin}/../lib64/LLVMgold.so"
)
type sanitizerType int
@@ -332,6 +333,7 @@
sanitizers = append(sanitizers, "cfi")
flags.CFlags = append(flags.CFlags, cfiCflags)
flags.LdFlags = append(flags.LdFlags, cfiLdflags)
+ flags.ArFlags = append(flags.ArFlags, cfiArflags)
if Bool(sanitize.Properties.Sanitize.Diag.Cfi) {
diagSanitizers = append(diagSanitizers, "cfi")
}