diff options
author | Jiyong Park <jiyong@google.com> | 2019-02-11 16:05:48 +0900 |
---|---|---|
committer | Jiyong Park <jiyong@google.com> | 2019-02-11 16:05:48 +0900 |
commit | acb4d21a2a9f47e99b2b9ab9cc89aa50e633baf6 (patch) | |
tree | 50869eeff4ad9b9860a7cc476ea92fafca9c2734 /build | |
parent | 808d176e7e0dd727c7f929622ec017f6e065c582 (diff) | |
download | bionic-acb4d21a2a9f47e99b2b9ab9cc89aa50e633baf6.tar.gz |
Symbols files under $(OUT)/symbols/bionic/
We need symbol files for /bionic/* paths.
New property "mountsource" is added to specify the "real" module that
the bionic mountpoint module is a mountpoint for. The real module
provides path to the unstripped elf file, which is installed to the
symbols/bionic/* path.
Bug: 123985838
Test: m libc.mountpoint libm.mountpoint libdl.mountpoint
linker.mountpoint
$(OUT)/symbols/bionic/bin/linker, bionic/lib[64]/lib{c|dl|m}.so exist
Change-Id: I43f074f0076b576f214fe92a98689a413efd3daa
Diffstat (limited to 'build')
-rw-r--r-- | build/Android.bp | 1 | ||||
-rw-r--r-- | build/bionic.go | 38 |
2 files changed, 38 insertions, 1 deletions
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") }, } } |