aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.bp4
-rw-r--r--build/Android.bp1
-rw-r--r--build/bionic.go38
3 files changed, 42 insertions, 1 deletions
diff --git a/Android.bp b/Android.bp
index 376c25064..72ab6c0d2 100644
--- a/Android.bp
+++ b/Android.bp
@@ -20,6 +20,7 @@ bionic_mountpoint {
src: "dummy_mountpoint",
library: true,
symlinks: ["libc.so"],
+ mountsource: "libc",
}
bionic_mountpoint {
@@ -28,6 +29,7 @@ bionic_mountpoint {
src: "dummy_mountpoint",
library: true,
symlinks: ["libdl.so"],
+ mountsource: "libdl",
}
bionic_mountpoint {
@@ -36,6 +38,7 @@ bionic_mountpoint {
src: "dummy_mountpoint",
library: true,
symlinks: ["libm.so"],
+ mountsource: "libm",
}
bionic_mountpoint {
@@ -49,4 +52,5 @@ bionic_mountpoint {
src: "dummy_mountpoint",
binary: true,
symlinks: ["linker", "linker_asan"],
+ mountsource: "linker",
}
diff --git a/build/Android.bp b/build/Android.bp
index 6cc160aef..acd0ee272 100644
--- a/build/Android.bp
+++ b/build/Android.bp
@@ -24,6 +24,7 @@ bootstrap_go_package {
"blueprint-proptools",
"soong",
"soong-android",
+ "soong-cc",
],
srcs: [
"bionic.go",
diff --git a/build/bionic.go b/build/bionic.go
index 3522acae8..93c24944f 100644
--- a/build/bionic.go
+++ b/build/bionic.go
@@ -19,9 +19,11 @@ import (
"io"
"strings"
+ "github.com/google/blueprint"
"github.com/google/blueprint/proptools"
"android/soong/android"
+ "android/soong/cc"
)
// bionic_mountpoint is a module type that is specialized to create
@@ -60,17 +62,24 @@ type bionicMountpoint struct {
outputFile android.Path
pathInPartition string
stem string
+ unstrippedOutputFile android.Path
}
type bionicMountpointProperties struct {
// The file that is installed as the mount point
Src *string
+ // TODO(jiyong) remove these two properties (probably Stem and Suffix
+ // as well, as they can be inteffered from Mountsource
+
// True if the mount point is for a Bionic library such libc.so
Library *bool
// True if the mount point is for a Bionic binary such as linker
Binary *bool
+ // The module that this module is a mount point for
+ Mountsource *string
+
// Base name of the mount point
Stem *string `android:"arch_variant"`
@@ -82,6 +91,13 @@ type bionicMountpointProperties struct {
Symlinks []string
}
+type dependencyTag struct {
+ blueprint.BaseDependencyTag
+ name string
+}
+
+var mountsourceTag = dependencyTag{name: "mountsource"}
+
func (m *bionicMountpoint) DepsMutator(ctx android.BottomUpMutatorContext) {
if Bool(m.properties.Library) == Bool(m.properties.Binary) {
ctx.ModuleErrorf("either binary or library must be set to true")
@@ -95,6 +111,17 @@ func (m *bionicMountpoint) DepsMutator(ctx android.BottomUpMutatorContext) {
ctx.PropertyErrorf("src", "src must be set")
}
android.ExtractSourceDeps(ctx, m.properties.Src)
+
+ if m.properties.Mountsource == nil {
+ ctx.PropertyErrorf("mountsource", "mountsource must be set")
+ return
+ }
+
+ ctx.AddFarVariationDependencies([]blueprint.Variation{
+ {Mutator: "arch", Variation: ctx.Target().String()},
+ {Mutator: "image", Variation: "core"},
+ {Mutator: "link", Variation: "shared"},
+ }, mountsourceTag, String(m.properties.Mountsource))
}
func (m *bionicMountpoint) GenerateAndroidBuildActions(ctx android.ModuleContext) {
@@ -110,6 +137,12 @@ func (m *bionicMountpoint) GenerateAndroidBuildActions(ctx android.ModuleContext
m.stem = String(m.properties.Stem) + String(m.properties.Suffix)
m.outputFile = ctx.ExpandSource(String(m.properties.Src), "src")
+
+ ctx.VisitDirectDepsWithTag(mountsourceTag, func(module android.Module) {
+ if cc, ok := module.(*cc.Module); ok {
+ m.unstrippedOutputFile = cc.UnstrippedOutputFile()
+ }
+ })
}
func (m *bionicMountpoint) AndroidMk() android.AndroidMkData {
@@ -148,7 +181,10 @@ func (m *bionicMountpoint) AndroidMk() android.AndroidMkData {
}
fmt.Fprintln(w, "LOCAL_POST_INSTALL_CMD := " + strings.Join(cmds, " && "))
}
- fmt.Fprintln(w, "include $(BUILD_PREBUILT)")
+ if m.unstrippedOutputFile != nil {
+ fmt.Fprintln(w, "LOCAL_SOONG_UNSTRIPPED_BINARY :=", m.unstrippedOutputFile.String())
+ }
+ fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_cc_prebuilt.mk")
},
}
}