Merge "Add Conscrypt to coverage"
diff --git a/android/arch.go b/android/arch.go
index 151cabd..957a659 100644
--- a/android/arch.go
+++ b/android/arch.go
@@ -155,18 +155,34 @@
"mips64r6",
},
X86: {
+ "amberlake",
"atom",
+ "broadwell",
"haswell",
+ "icelake",
"ivybridge",
+ "kabylake",
"sandybridge",
"silvermont",
+ "skylake",
+ "stoneyridge",
+ "tigerlake",
+ "whiskeylake",
"x86_64",
},
X86_64: {
+ "amberlake",
+ "broadwell",
"haswell",
+ "icelake",
"ivybridge",
+ "kabylake",
"sandybridge",
"silvermont",
+ "skylake",
+ "stoneyridge",
+ "tigerlake",
+ "whiskeylake",
},
}
@@ -190,6 +206,8 @@
"sse4_2",
"aes_ni",
"avx",
+ "avx2",
+ "avx512",
"popcnt",
"movbe",
},
@@ -200,6 +218,8 @@
"sse4_2",
"aes_ni",
"avx",
+ "avx2",
+ "avx512",
"popcnt",
},
}
@@ -230,10 +250,30 @@
},
},
X86: {
+ "amberlake": {
+ "ssse3",
+ "sse4",
+ "sse4_1",
+ "sse4_2",
+ "avx",
+ "avx2",
+ "aes_ni",
+ "popcnt",
+ },
"atom": {
"ssse3",
"movbe",
},
+ "broadwell": {
+ "ssse3",
+ "sse4",
+ "sse4_1",
+ "sse4_2",
+ "avx",
+ "avx2",
+ "aes_ni",
+ "popcnt",
+ },
"haswell": {
"ssse3",
"sse4",
@@ -244,6 +284,17 @@
"popcnt",
"movbe",
},
+ "icelake": {
+ "ssse3",
+ "sse4",
+ "sse4_1",
+ "sse4_2",
+ "avx",
+ "avx2",
+ "avx512",
+ "aes_ni",
+ "popcnt",
+ },
"ivybridge": {
"ssse3",
"sse4",
@@ -253,6 +304,16 @@
"avx",
"popcnt",
},
+ "kabylake": {
+ "ssse3",
+ "sse4",
+ "sse4_1",
+ "sse4_2",
+ "avx",
+ "avx2",
+ "aes_ni",
+ "popcnt",
+ },
"sandybridge": {
"ssse3",
"sse4",
@@ -269,6 +330,50 @@
"popcnt",
"movbe",
},
+ "skylake": {
+ "ssse3",
+ "sse4",
+ "sse4_1",
+ "sse4_2",
+ "avx",
+ "avx2",
+ "avx512",
+ "aes_ni",
+ "popcnt",
+ },
+ "stoneyridge": {
+ "ssse3",
+ "sse4",
+ "sse4_1",
+ "sse4_2",
+ "aes_ni",
+ "avx",
+ "avx2",
+ "popcnt",
+ "movbe",
+ },
+ "tigerlake": {
+ "ssse3",
+ "sse4",
+ "sse4_1",
+ "sse4_2",
+ "avx",
+ "avx2",
+ "avx512",
+ "aes_ni",
+ "popcnt",
+ },
+ "whiskeylake": {
+ "ssse3",
+ "sse4",
+ "sse4_1",
+ "sse4_2",
+ "avx",
+ "avx2",
+ "avx512",
+ "aes_ni",
+ "popcnt",
+ },
"x86_64": {
"ssse3",
"sse4",
@@ -278,6 +383,26 @@
},
},
X86_64: {
+ "amberlake": {
+ "ssse3",
+ "sse4",
+ "sse4_1",
+ "sse4_2",
+ "avx",
+ "avx2",
+ "aes_ni",
+ "popcnt",
+ },
+ "broadwell": {
+ "ssse3",
+ "sse4",
+ "sse4_1",
+ "sse4_2",
+ "avx",
+ "avx2",
+ "aes_ni",
+ "popcnt",
+ },
"haswell": {
"ssse3",
"sse4",
@@ -287,6 +412,17 @@
"avx",
"popcnt",
},
+ "icelake": {
+ "ssse3",
+ "sse4",
+ "sse4_1",
+ "sse4_2",
+ "avx",
+ "avx2",
+ "avx512",
+ "aes_ni",
+ "popcnt",
+ },
"ivybridge": {
"ssse3",
"sse4",
@@ -296,6 +432,16 @@
"avx",
"popcnt",
},
+ "kabylake": {
+ "ssse3",
+ "sse4",
+ "sse4_1",
+ "sse4_2",
+ "avx",
+ "avx2",
+ "aes_ni",
+ "popcnt",
+ },
"sandybridge": {
"ssse3",
"sse4",
@@ -311,6 +457,49 @@
"aes_ni",
"popcnt",
},
+ "skylake": {
+ "ssse3",
+ "sse4",
+ "sse4_1",
+ "sse4_2",
+ "avx",
+ "avx2",
+ "avx512",
+ "aes_ni",
+ "popcnt",
+ },
+ "stoneyridge": {
+ "ssse3",
+ "sse4",
+ "sse4_1",
+ "sse4_2",
+ "aes_ni",
+ "avx",
+ "avx2",
+ "popcnt",
+ },
+ "tigerlake": {
+ "ssse3",
+ "sse4",
+ "sse4_1",
+ "sse4_2",
+ "avx",
+ "avx2",
+ "avx512",
+ "aes_ni",
+ "popcnt",
+ },
+ "whiskeylake": {
+ "ssse3",
+ "sse4",
+ "sse4_1",
+ "sse4_2",
+ "avx",
+ "avx2",
+ "avx512",
+ "aes_ni",
+ "popcnt",
+ },
},
}
@@ -1356,12 +1545,14 @@
{"x86", "ivybridge", "", []string{"x86"}},
{"x86", "sandybridge", "", []string{"x86"}},
{"x86", "silvermont", "", []string{"x86"}},
+ {"x86", "stoneyridge", "", []string{"x86"}},
{"x86", "x86_64", "", []string{"x86"}},
{"x86_64", "", "", []string{"x86_64"}},
{"x86_64", "haswell", "", []string{"x86_64"}},
{"x86_64", "ivybridge", "", []string{"x86_64"}},
{"x86_64", "sandybridge", "", []string{"x86_64"}},
{"x86_64", "silvermont", "", []string{"x86_64"}},
+ {"x86_64", "stoneyridge", "", []string{"x86_64"}},
}
}
diff --git a/android/filegroup.go b/android/filegroup.go
index 76af804..c2be22a 100644
--- a/android/filegroup.go
+++ b/android/filegroup.go
@@ -49,9 +49,9 @@
var _ SourceFileProducer = (*fileGroup)(nil)
-// filegroup modules contain a list of files, and can be used to export files across package
-// boundaries. filegroups (and genrules) can be referenced from srcs properties of other modules
-// using the syntax ":module".
+// filegroup contains a list of files that are referenced by other modules
+// properties (such as "srcs") using the syntax ":<name>". filegroup are
+// also be used to export files across package boundaries.
func FileGroupFactory() Module {
module := &fileGroup{}
module.AddProperties(&module.properties)
diff --git a/android/module.go b/android/module.go
index c1f3e79..9a69a26 100644
--- a/android/module.go
+++ b/android/module.go
@@ -124,6 +124,7 @@
InstallExecutable(installPath OutputPath, name string, srcPath Path, deps ...Path) OutputPath
InstallFile(installPath OutputPath, name string, srcPath Path, deps ...Path) OutputPath
InstallSymlink(installPath OutputPath, name string, srcPath OutputPath) OutputPath
+ InstallAbsoluteSymlink(installPath OutputPath, name string, absPath string) OutputPath
CheckbuildFile(srcPath Path)
AddMissingDependencies(deps []string)
@@ -382,6 +383,7 @@
&base.nameProperties,
&base.commonProperties,
&base.variableProperties)
+ base.generalProperties = m.GetProperties()
base.customizableProperties = m.GetProperties()
}
@@ -1316,6 +1318,28 @@
return fullInstallPath
}
+// installPath/name -> absPath where absPath might be a path that is available only at runtime
+// (e.g. /apex/...)
+func (a *androidModuleContext) InstallAbsoluteSymlink(installPath OutputPath, name string, absPath string) OutputPath {
+ fullInstallPath := installPath.Join(a, name)
+ a.module.base().hooks.runInstallHooks(a, fullInstallPath, true)
+
+ if !a.skipInstall(fullInstallPath) {
+ a.Build(pctx, BuildParams{
+ Rule: Symlink,
+ Description: "install symlink " + fullInstallPath.Base() + " -> " + absPath,
+ Output: fullInstallPath,
+ Default: !a.Config().EmbeddedInMake(),
+ Args: map[string]string{
+ "fromPath": absPath,
+ },
+ })
+
+ a.installFiles = append(a.installFiles, fullInstallPath)
+ }
+ return fullInstallPath
+}
+
func (a *androidModuleContext) CheckbuildFile(srcPath Path) {
a.checkbuildFiles = append(a.checkbuildFiles, srcPath)
}
diff --git a/android/path_properties.go b/android/path_properties.go
index 5d89709..1a12290 100644
--- a/android/path_properties.go
+++ b/android/path_properties.go
@@ -33,7 +33,7 @@
return
}
- props := m.base().customizableProperties
+ props := m.base().generalProperties
for _, ps := range props {
pathProperties := pathPropertiesForPropertyStruct(ctx, ps)
diff --git a/android/path_properties_test.go b/android/path_properties_test.go
index 6471a3c..ecc2d21 100644
--- a/android/path_properties_test.go
+++ b/android/path_properties_test.go
@@ -25,7 +25,7 @@
ModuleBase
props struct {
Foo string `android:"path"`
- Bar []string `android:"path"`
+ Bar []string `android:"path,arch_variant"`
Baz *string `android:"path"`
Qux string
}
@@ -36,7 +36,7 @@
func pathDepsMutatorTestModuleFactory() Module {
module := &pathDepsMutatorTestModule{}
module.AddProperties(&module.props)
- InitAndroidModule(module)
+ InitAndroidArchModule(module, DeviceSupported, MultilibBoth)
return module
}
@@ -64,6 +64,23 @@
}`,
deps: []string{"a", "b", "c"},
},
+ {
+ name: "arch variant",
+ bp: `
+ test {
+ name: "foo",
+ arch: {
+ arm64: {
+ bar: [":a"],
+ },
+ arm: {
+ bar: [":b"],
+ },
+ },
+ bar: [":c"],
+ }`,
+ deps: []string{"c", "a"},
+ },
}
buildDir, err := ioutil.TempDir("", "soong_path_properties_test")
@@ -74,8 +91,8 @@
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
- config := TestConfig(buildDir, nil)
- ctx := NewTestContext()
+ config := TestArchConfig(buildDir, nil)
+ ctx := NewTestArchContext()
ctx.RegisterModuleType("test", ModuleFactoryAdaptor(pathDepsMutatorTestModuleFactory))
ctx.RegisterModuleType("filegroup", ModuleFactoryAdaptor(FileGroupFactory))
@@ -110,7 +127,7 @@
_, errs = ctx.PrepareBuildActions(config)
FailIfErrored(t, errs)
- m := ctx.ModuleForTests("foo", "").Module().(*pathDepsMutatorTestModule)
+ m := ctx.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*pathDepsMutatorTestModule)
if g, w := m.sourceDeps, test.deps; !reflect.DeepEqual(g, w) {
t.Errorf("want deps %q, got %q", w, g)
diff --git a/android/sh_binary.go b/android/sh_binary.go
index 52c5a9a..8bb3517 100644
--- a/android/sh_binary.go
+++ b/android/sh_binary.go
@@ -17,6 +17,7 @@
import (
"fmt"
"io"
+ "strings"
)
// sh_binary is for shell scripts (and batch files) that are installed as
@@ -28,6 +29,7 @@
func init() {
RegisterModuleType("sh_binary", ShBinaryFactory)
RegisterModuleType("sh_binary_host", ShBinaryHostFactory)
+ RegisterModuleType("sh_test", ShTestFactory)
}
type shBinaryProperties struct {
@@ -48,6 +50,16 @@
Installable *bool
}
+type TestProperties struct {
+ // list of compatibility suites (for example "cts", "vts") that the module should be
+ // installed into.
+ Test_suites []string `android:"arch_variant"`
+
+ // the name of the test configuration (for example "AndroidTest.xml") that should be
+ // installed with the module.
+ Test_config *string `android:"arch_variant"`
+}
+
type ShBinary struct {
ModuleBase
@@ -57,6 +69,12 @@
outputFilePath OutputPath
}
+type ShTest struct {
+ ShBinary
+
+ testProperties TestProperties
+}
+
func (s *ShBinary) DepsMutator(ctx BottomUpMutatorContext) {
if s.properties.Src == nil {
ctx.PropertyErrorf("src", "missing prebuilt source file")
@@ -119,6 +137,16 @@
}
}
+func (s *ShTest) AndroidMk() AndroidMkData {
+ data := s.ShBinary.AndroidMk()
+ data.Extra = append(data.Extra, func(w io.Writer, outputFile Path) {
+ fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUITE :=",
+ strings.Join(s.testProperties.Test_suites, " "))
+ fmt.Fprintln(w, "LOCAL_TEST_CONFIG :=", String(s.testProperties.Test_config))
+ })
+ return data
+}
+
func InitShBinaryModule(s *ShBinary) {
s.AddProperties(&s.properties)
}
@@ -140,3 +168,12 @@
InitAndroidArchModule(module, HostSupported, MultilibFirst)
return module
}
+
+func ShTestFactory() Module {
+ module := &ShTest{}
+ InitShBinaryModule(&module.ShBinary)
+ module.AddProperties(&module.testProperties)
+
+ InitAndroidArchModule(module, HostAndDeviceSupported, MultilibFirst)
+ return module
+}
diff --git a/android/util.go b/android/util.go
index 8fc159d..f9dce6f 100644
--- a/android/util.go
+++ b/android/util.go
@@ -15,6 +15,8 @@
package android
import (
+ "fmt"
+ "regexp"
"runtime"
"sort"
"strings"
@@ -164,12 +166,17 @@
panic("not called from an init func")
}
- if funcName == "init" || strings.HasPrefix(funcName, "init·") {
+ if funcName == "init" || strings.HasPrefix(funcName, "init·") ||
+ strings.HasPrefix(funcName, "init.") {
return
}
}
}
+// A regex to find a package path within a function name. It finds the shortest string that is
+// followed by '.' and doesn't have any '/'s left.
+var pkgPathRe = regexp.MustCompile(`^(.*?)\.([^/]+)$`)
+
// callerName returns the package path and function name of the calling
// function. The skip argument has the same meaning as the skip argument of
// runtime.Callers.
@@ -180,25 +187,13 @@
return "", "", false
}
- f := runtime.FuncForPC(pc[0])
- fullName := f.Name()
-
- lastDotIndex := strings.LastIndex(fullName, ".")
- if lastDotIndex == -1 {
- panic("unable to distinguish function name from package")
+ f := runtime.FuncForPC(pc[0]).Name()
+ s := pkgPathRe.FindStringSubmatch(f)
+ if len(s) < 3 {
+ panic(fmt.Errorf("failed to extract package path and function name from %q", f))
}
- if fullName[lastDotIndex-1] == ')' {
- // The caller is a method on some type, so it's name looks like
- // "pkg/path.(type).method". We need to go back one dot farther to get
- // to the package name.
- lastDotIndex = strings.LastIndex(fullName[:lastDotIndex], ".")
- }
-
- pkgPath = fullName[:lastDotIndex]
- funcName = fullName[lastDotIndex+1:]
- ok = true
- return
+ return s[1], s[2], true
}
func GetNumericSdkVersion(v string) string {
diff --git a/android/vts_config.go b/android/vts_config.go
index f468ba8..c44b3a3 100644
--- a/android/vts_config.go
+++ b/android/vts_config.go
@@ -19,14 +19,12 @@
"io"
)
-// Implements vts_config module
-
func init() {
RegisterModuleType("vts_config", VtsConfigFactory)
}
type vtsConfigProperties struct {
- // Test manifest file name if different from AndroidTest.xml.
+ // Override the default (AndroidTest.xml) test manifest file name.
Test_config *string
}
@@ -61,7 +59,8 @@
me.AddProperties(&me.properties)
}
-// Defines VTS configuration.
+// vts_config generates a Vendor Test Suite (VTS) configuration file from the
+// <test_config> xml file and stores it in a subdirectory of $(HOST_OUT).
func VtsConfigFactory() Module {
module := &VtsConfig{}
InitVtsConfigModule(module)
diff --git a/androidmk/cmd/androidmk/android.go b/androidmk/cmd/androidmk/android.go
index 1d66ab7..9276eb5 100644
--- a/androidmk/cmd/androidmk/android.go
+++ b/androidmk/cmd/androidmk/android.go
@@ -76,6 +76,8 @@
"LOCAL_ANNOTATION_PROCESSOR_CLASSES": skip, // Soong gets the processor classes from the plugin
"LOCAL_CTS_TEST_PACKAGE": skip, // Obsolete
+ "LOCAL_JACK_ENABLED": skip, // Obselete
+ "LOCAL_JACK_FLAGS": skip, // Obselete
}
// adds a group of properties all having the same type
diff --git a/androidmk/cmd/androidmk/androidmk_test.go b/androidmk/cmd/androidmk/androidmk_test.go
index 2976a0c..b2c3fab 100644
--- a/androidmk/cmd/androidmk/androidmk_test.go
+++ b/androidmk/cmd/androidmk/androidmk_test.go
@@ -1094,6 +1094,22 @@
}
`,
},
+ {
+ desc: "LOCAL_JACK_ENABLED and LOCAL_JACK_FLAGS skipped",
+ in: `
+include $(CLEAR_VARS)
+LOCAL_MODULE := foo
+LOCAL_JACK_ENABLED := incremental
+LOCAL_JACK_FLAGS := --multi-dex native
+include $(BUILD_PACKAGE)
+ `,
+ expected: `
+android_app {
+ name: "foo",
+
+}
+ `,
+ },
}
func TestEndToEnd(t *testing.T) {
diff --git a/apex/apex.go b/apex/apex.go
index 341968b..04b70d4 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -218,6 +218,10 @@
// If unspecified, a default one is automatically generated.
AndroidManifest *string `android:"path"`
+ // Canonical name of the APEX bundle in the manifest file.
+ // If unspecified, defaults to the value of name
+ Apex_name *string
+
// Determines the file contexts file for setting security context to each file in this APEX bundle.
// Specifically, when this is set to <value>, /system/sepolicy/apex/<value>_file_contexts file is
// used.
@@ -613,9 +617,7 @@
}
func getCopyManifestForExecutable(cc *cc.Module) (fileToCopy android.Path, dirInApex string) {
- // TODO(b/123721777) respect relative_install_path also for binaries
- // dirInApex = filepath.Join("bin", cc.RelativeInstallPath())
- dirInApex = "bin"
+ dirInApex = filepath.Join("bin", cc.RelativeInstallPath())
fileToCopy = cc.OutputFile().Path()
return
}
@@ -1065,17 +1067,19 @@
fmt.Fprintln(w, "\ninclude $(CLEAR_VARS)")
fmt.Fprintln(w, "LOCAL_PATH :=", moduleDir)
fmt.Fprintln(w, "LOCAL_MODULE :=", fi.moduleName)
+ // /apex/<name>/{lib|framework|...}
+ pathWhenActivated := filepath.Join("$(PRODUCT_OUT)", "apex",
+ proptools.StringDefault(a.properties.Apex_name, name), fi.installDir)
if a.flattened && apexType.image() {
// /system/apex/<name>/{lib|framework|...}
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", filepath.Join("$(OUT_DIR)",
a.installDir.RelPathString(), name, fi.installDir))
+ fmt.Fprintln(w, "LOCAL_SOONG_SYMBOL_PATH :=", pathWhenActivated)
if len(fi.symlinks) > 0 {
fmt.Fprintln(w, "LOCAL_MODULE_SYMLINKS :=", strings.Join(fi.symlinks, " "))
}
} else {
- // /apex/<name>/{lib|framework|...}
- fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", filepath.Join("$(PRODUCT_OUT)",
- "apex", name, fi.installDir))
+ fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", pathWhenActivated)
}
fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", fi.builtFile.String())
fmt.Fprintln(w, "LOCAL_MODULE_CLASS :=", fi.class.NameInMake())
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 66f0725..f221cf2 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -696,10 +696,9 @@
ensureListContains(t, dirs, "lib/foo")
ensureListContains(t, dirs, "lib/foo/bar")
- // TODO(b/123721777) respect relative path for binaries
- // ensureListContains(t, dirs, "bin")
- // ensureListContains(t, dirs, "bin/foo")
- // ensureListContains(t, dirs, "bin/foo/bar")
+ ensureListContains(t, dirs, "bin")
+ ensureListContains(t, dirs, "bin/foo")
+ ensureListContains(t, dirs, "bin/foo/bar")
}
func TestUseVendor(t *testing.T) {
@@ -827,7 +826,7 @@
`)
// check the APEX keys
- keys := ctx.ModuleForTests("myapex.key", "").Module().(*apexKey)
+ keys := ctx.ModuleForTests("myapex.key", "android_common").Module().(*apexKey)
if keys.public_key_file.String() != "vendor/foo/devkeys/testkey.avbpubkey" {
t.Errorf("public key %q is not %q", keys.public_key_file.String(),
@@ -1144,3 +1143,43 @@
ensureContains(t, copyCmds, "image.apex/bin/script/myscript.sh")
}
+
+func TestApexInProductPartition(t *testing.T) {
+ ctx := testApex(t, `
+ apex {
+ name: "myapex",
+ key: "myapex.key",
+ native_shared_libs: ["mylib"],
+ product_specific: true,
+ }
+
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ product_specific: true,
+ }
+
+ cc_library {
+ name: "mylib",
+ srcs: ["mylib.cpp"],
+ system_shared_libs: [],
+ stl: "none",
+ }
+ `)
+
+ apex := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
+ expected := "target/product/test_device/product/apex"
+ actual := apex.installDir.RelPathString()
+ if actual != expected {
+ t.Errorf("wrong install path. expected %q. actual %q", expected, actual)
+ }
+
+ apex_key := ctx.ModuleForTests("myapex.key", "android_common").Module().(*apexKey)
+ expected = "target/product/test_device/product/etc/security/apex"
+ actual = apex_key.installDir.RelPathString()
+ if actual != expected {
+ t.Errorf("wrong install path. expected %q. actual %q", expected, actual)
+ }
+
+}
diff --git a/apex/key.go b/apex/key.go
index 5d7c2fa..07c3105 100644
--- a/apex/key.go
+++ b/apex/key.go
@@ -17,6 +17,7 @@
import (
"fmt"
"io"
+ "path/filepath"
"strings"
"android/soong/android"
@@ -38,6 +39,7 @@
public_key_file android.Path
private_key_file android.Path
+ installDir android.OutputPath
keyName string
}
@@ -56,7 +58,8 @@
func apexKeyFactory() android.Module {
module := &apexKey{}
module.AddProperties(&module.properties)
- android.InitAndroidModule(module)
+ // This module is device-only
+ android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
return module
}
@@ -86,8 +89,9 @@
}
m.keyName = pubKeyName
+ m.installDir = android.PathForModuleInstall(ctx, "etc/security/apex")
if m.installable() {
- ctx.InstallFile(android.PathForModuleInstall(ctx, "etc/security/apex"), m.keyName, m.public_key_file)
+ ctx.InstallFile(m.installDir, m.keyName, m.public_key_file)
}
}
@@ -97,7 +101,7 @@
OutputFile: android.OptionalPathForPath(m.public_key_file),
Extra: []android.AndroidMkExtraFunc{
func(w io.Writer, outputFile android.Path) {
- fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", "$(TARGET_OUT)/etc/security/apex")
+ fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", filepath.Join("$(OUT_DIR)", m.installDir.RelPathString()))
fmt.Fprintln(w, "LOCAL_INSTALLED_MODULE_STEM :=", m.keyName)
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE :=", !m.installable())
},
diff --git a/cc/androidmk.go b/cc/androidmk.go
index fc791fe..d229d0c 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -158,6 +158,9 @@
if len(library.Properties.Overrides) > 0 {
fmt.Fprintln(w, "LOCAL_OVERRIDES_MODULES := "+strings.Join(library.Properties.Overrides, " "))
}
+ if len(library.post_install_cmds) > 0 {
+ fmt.Fprintln(w, "LOCAL_POST_INSTALL_CMD := "+strings.Join(library.post_install_cmds, "&& "))
+ }
})
} else if library.header() {
ret.Class = "HEADER_LIBRARIES"
@@ -231,6 +234,9 @@
if len(binary.Properties.Overrides) > 0 {
fmt.Fprintln(w, "LOCAL_OVERRIDES_MODULES := "+strings.Join(binary.Properties.Overrides, " "))
}
+ if len(binary.post_install_cmds) > 0 {
+ fmt.Fprintln(w, "LOCAL_POST_INSTALL_CMD := "+strings.Join(binary.post_install_cmds, "&& "))
+ }
})
}
diff --git a/cc/binary.go b/cc/binary.go
index 4794815..cae1739 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -15,6 +15,8 @@
package cc
import (
+ "path/filepath"
+
"github.com/google/blueprint"
"android/soong/android"
@@ -91,6 +93,8 @@
// Location of the file that should be copied to dist dir when requested
distFile android.OptionalPath
+
+ post_install_cmds []string
}
var _ linker = (*binaryDecorator)(nil)
@@ -249,7 +253,7 @@
} else {
switch ctx.Os() {
case android.Android:
- if ctx.bootstrap() {
+ if ctx.bootstrap() && !ctx.inRecovery() {
flags.DynamicLinker = "/system/bin/bootstrap/linker"
} else {
flags.DynamicLinker = "/system/bin/linker"
@@ -413,7 +417,31 @@
return binary.symlinks
}
+// /system/bin/linker -> /apex/com.android.runtime/bin/linker
+func (binary *binaryDecorator) installSymlinkToRuntimeApex(ctx ModuleContext, file android.Path) {
+ dir := binary.baseInstaller.installDir(ctx)
+ dirOnDevice := android.InstallPathToOnDevicePath(ctx, dir)
+ target := "/" + filepath.Join("apex", "com.android.runtime", dir.Base(), file.Base())
+
+ ctx.InstallAbsoluteSymlink(dir, file.Base(), target)
+ binary.post_install_cmds = append(binary.post_install_cmds, makeSymlinkCmd(dirOnDevice, file.Base(), target))
+
+ for _, symlink := range binary.symlinks {
+ ctx.InstallAbsoluteSymlink(dir, symlink, target)
+ binary.post_install_cmds = append(binary.post_install_cmds, makeSymlinkCmd(dirOnDevice, symlink, target))
+ }
+}
+
func (binary *binaryDecorator) install(ctx ModuleContext, file android.Path) {
+ // Bionic binaries (e.g. linker) is installed to the bootstrap subdirectory.
+ // The original path becomes a symlink to the corresponding file in the
+ // runtime APEX.
+ if isBionic(ctx.baseModuleName()) && ctx.Arch().Native && ctx.apexName() == "" && !ctx.inRecovery() {
+ if ctx.Device() {
+ binary.installSymlinkToRuntimeApex(ctx, file)
+ }
+ binary.baseInstaller.subDir = "bootstrap"
+ }
binary.baseInstaller.install(ctx, file)
for _, symlink := range binary.symlinks {
ctx.InstallSymlink(binary.baseInstaller.installDir(ctx), symlink, binary.baseInstaller.path)
diff --git a/cc/cc.go b/cc/cc.go
index 284b58d..c036b84 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -599,6 +599,14 @@
return Bool(c.Properties.Bootstrap)
}
+func isBionic(name string) bool {
+ switch name {
+ case "libc", "libm", "libdl", "linker":
+ return true
+ }
+ return false
+}
+
type baseModuleContext struct {
android.BaseContext
moduleContextImpl
diff --git a/cc/config/clang.go b/cc/config/clang.go
index 6a1c736..22969eb 100644
--- a/cc/config/clang.go
+++ b/cc/config/clang.go
@@ -97,6 +97,10 @@
pctx.StaticVariable("ClangExtraCflags", strings.Join([]string{
"-D__compiler_offsetof=__builtin_offsetof",
+ // Emit address-significance table which allows linker to perform safe ICF. Clang does
+ // not emit the table by default on Android since NDK still uses GNU binutils.
+ "-faddrsig",
+
// -Wimplicit-fallthrough is not enabled by -Wall.
"-Wimplicit-fallthrough",
@@ -174,6 +178,10 @@
// Disable this warning because we don't care about behavior with older compilers.
"-Wno-return-std-move-in-c++11",
+
+ // Disable -Wstring-plus-int until the instances detected by this new warning is
+ // fixed.
+ "-Wno-string-plus-int",
}, " "))
// Extra cflags for projects under external/ directory
diff --git a/cc/config/global.go b/cc/config/global.go
index 689b315..e3fab0c 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -120,8 +120,8 @@
// prebuilts/clang default settings.
ClangDefaultBase = "prebuilts/clang/host"
- ClangDefaultVersion = "clang-r349610"
- ClangDefaultShortVersion = "8.0.8"
+ ClangDefaultVersion = "clang-r353983"
+ ClangDefaultShortVersion = "9.0.1"
// Directories with warnings from Android.bp files.
WarningAllowedProjects = []string{
diff --git a/cc/config/x86_64_device.go b/cc/config/x86_64_device.go
index 4264eda..0f0420f 100644
--- a/cc/config/x86_64_device.go
+++ b/cc/config/x86_64_device.go
@@ -38,6 +38,10 @@
"": []string{
"-march=x86-64",
},
+ "broadwell": []string{
+ "-march=broadwell",
+ },
+
"haswell": []string{
"-march=core-avx2",
},
@@ -50,6 +54,12 @@
"silvermont": []string{
"-march=slm",
},
+ "skylake": []string{
+ "-march=skylake",
+ },
+ "stoneyridge": []string{
+ "-march=bdver4",
+ },
}
x86_64ArchFeatureCflags = map[string][]string{
@@ -59,6 +69,8 @@
"sse4_2": []string{"-msse4.2"},
"popcnt": []string{"-mpopcnt"},
"avx": []string{"-mavx"},
+ "avx2": []string{"-mavx2"},
+ "avx512": []string{"-mavx512"},
"aes_ni": []string{"-maes"},
}
)
diff --git a/cc/config/x86_device.go b/cc/config/x86_device.go
index 34e7df8..500014e 100644
--- a/cc/config/x86_device.go
+++ b/cc/config/x86_device.go
@@ -51,6 +51,10 @@
"-march=atom",
"-mfpmath=sse",
},
+ "broadwell": []string{
+ "-march=broadwell",
+ "-mfpmath=sse",
+ },
"haswell": []string{
"-march=core-avx2",
"-mfpmath=sse",
@@ -67,6 +71,14 @@
"-march=slm",
"-mfpmath=sse",
},
+ "skylake": []string{
+ "-march=skylake",
+ "-mfpmath=sse",
+ },
+ "stoneyridge": []string{
+ "-march=bdver4",
+ "-mfpmath=sse",
+ },
}
x86ArchFeatureCflags = map[string][]string{
@@ -75,6 +87,7 @@
"sse4_1": []string{"-msse4.1"},
"sse4_2": []string{"-msse4.2"},
"avx": []string{"-mavx"},
+ "avx2": []string{"-mavx2"},
"aes_ni": []string{"-maes"},
}
)
diff --git a/cc/library.go b/cc/library.go
index 71a9df6..5df5112 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -15,6 +15,7 @@
package cc
import (
+ "path/filepath"
"regexp"
"sort"
"strconv"
@@ -290,6 +291,8 @@
versionScriptPath android.ModuleGenPath
+ post_install_cmds []string
+
// Decorated interafaces
*baseCompiler
*baseLinker
@@ -888,6 +891,14 @@
return library.tocFile
}
+func (library *libraryDecorator) installSymlinkToRuntimeApex(ctx ModuleContext, file android.Path) {
+ dir := library.baseInstaller.installDir(ctx)
+ dirOnDevice := android.InstallPathToOnDevicePath(ctx, dir)
+ target := "/" + filepath.Join("apex", "com.android.runtime", dir.Base(), "bionic", file.Base())
+ ctx.InstallAbsoluteSymlink(dir, file.Base(), target)
+ library.post_install_cmds = append(library.post_install_cmds, makeSymlinkCmd(dirOnDevice, file.Base(), target))
+}
+
func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) {
if library.shared() {
if ctx.Device() && ctx.useVndk() {
@@ -905,15 +916,13 @@
}
}
} else if len(library.Properties.Stubs.Versions) > 0 && android.DirectlyInAnyApex(ctx, ctx.ModuleName()) {
- // If a library in an APEX has stable versioned APIs, we basically don't need
- // to have the platform variant of the library in /system partition because
- // platform components can just use the lib from the APEX without fearing about
- // compatibility. However, if the library is required for some early processes
- // before the APEX is activated, the platform variant may also be required.
- // In that case, it is installed to the subdirectory 'bootstrap' in order to
- // be distinguished/isolated from other non-bootstrap libraries in /system/lib
- // so that the bootstrap libraries are used only when the APEX isn't ready.
- if !library.buildStubs() && ctx.Arch().Native {
+ // Bionic libraries (e.g. libc.so) is installed to the bootstrap subdirectory.
+ // The original path becomes a symlink to the corresponding file in the
+ // runtime APEX.
+ if isBionic(ctx.baseModuleName()) && !library.buildStubs() && ctx.Arch().Native && !ctx.inRecovery() {
+ if ctx.Device() {
+ library.installSymlinkToRuntimeApex(ctx, file)
+ }
library.baseInstaller.subDir = "bootstrap"
}
}
diff --git a/cc/lto.go b/cc/lto.go
index 6302748..0d7a246 100644
--- a/cc/lto.go
+++ b/cc/lto.go
@@ -83,8 +83,7 @@
if lto.LTO() {
var ltoFlag string
if Bool(lto.Properties.Lto.Thin) {
- ltoFlag = "-flto=thin"
-
+ ltoFlag = "-flto=thin -fsplit-lto-unit"
} else {
ltoFlag = "-flto"
}
diff --git a/cc/util.go b/cc/util.go
index 925dd74..782bf61 100644
--- a/cc/util.go
+++ b/cc/util.go
@@ -133,3 +133,10 @@
return root, suffix, ext
}
+
+// linkDirOnDevice/linkName -> target
+func makeSymlinkCmd(linkDirOnDevice string, linkName string, target string) string {
+ dir := filepath.Join("$(PRODUCT_OUT)", linkDirOnDevice)
+ return "mkdir -p " + dir + " && " +
+ "ln -sf " + target + " " + filepath.Join(dir, linkName)
+}
diff --git a/cmd/soong_build/writedocs.go b/cmd/soong_build/writedocs.go
index 5171b68..d011e77 100644
--- a/cmd/soong_build/writedocs.go
+++ b/cmd/soong_build/writedocs.go
@@ -276,8 +276,9 @@
{{- else -}}
<div class="simple" id="{{getModule}}.{{.Name}}">
<span class="fixed"> </span><b>{{.Name}} {{range .OtherNames}}, {{.}}{{end -}}</b>
- {{- if .Text -}}{{.Text}}{{- end -}}
- {{- with .OtherTexts -}}{{.}}{{- end -}}<i>{{.Type}}</i>
+ <i>{{.Type}}</i>
+ {{- if .Text -}}{{if ne .Text "\n"}}, {{end}}{{.Text}}{{- end -}}
+ {{- with .OtherTexts -}}{{.}}{{- end -}}
{{- if .Default -}}<i>Default: {{.Default}}</i>{{- end -}}
</div>
{{- end}}
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 6441c63..18866d5 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -675,6 +675,34 @@
if module.sdkLibraryProperties.Api_packages == nil {
mctx.PropertyErrorf("api_packages", "java_sdk_library must specify api_packages")
}
+
+ missing_current_api := false
+
+ for _, scope := range []string{"", "system-", "test-"} {
+ for _, api := range []string{"current.txt", "removed.txt"} {
+ path := path.Join(mctx.ModuleDir(), "api", scope+api)
+ p := android.ExistentPathForSource(mctx, path)
+ if !p.Valid() {
+ mctx.ModuleErrorf("Current api file %#v doesn't exist", path)
+ missing_current_api = true
+ }
+ }
+ }
+
+ if missing_current_api {
+ script := "build/soong/scripts/gen-java-current-api-files.sh"
+ p := android.ExistentPathForSource(mctx, script)
+
+ if !p.Valid() {
+ panic(fmt.Sprintf("script file %s doesn't exist", script))
+ }
+
+ mctx.ModuleErrorf("One or more current api files are missing. "+
+ "You can update them by:\n"+
+ "%s %q && m update-api", script, mctx.ModuleDir())
+ return
+ }
+
// for public API stubs
module.createStubsLibrary(mctx, apiScopePublic)
module.createDocs(mctx, apiScopePublic)
diff --git a/scripts/gen-java-current-api-files.sh b/scripts/gen-java-current-api-files.sh
new file mode 100755
index 0000000..517d391
--- /dev/null
+++ b/scripts/gen-java-current-api-files.sh
@@ -0,0 +1,33 @@
+#!/bin/bash -e
+
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+if [[ -z "$1" ]]; then
+ echo "usage: $0 <modulePath>" >&2
+ exit 1
+fi
+
+api_dir=$1/api
+
+mkdir -p "$api_dir"
+
+scopes=("" system- test-)
+apis=(current removed)
+
+for scope in "${scopes[@]}"; do
+ for api in "${apis[@]}"; do
+ touch "${api_dir}/${scope}${api}.txt"
+ done
+done