Use soong_cc_prebuilt.mk instead of prebuilt.mk for Soong cc modules
Export Soong cc modules to Make using a new soong_cc_prebuilt.mk that bypasses all of prebuilt_internal.mk, dynamic_binary.mk and binary.mk. This also means that stripping is handled in Soong instead of Make. Bug: 113936524 Test: m checkbuild Change-Id: If9008c50920779048480f5eeeb0084f26006c998
This commit is contained in:
parent
0f40a7527a
commit
e2874cd99d
|
@ -60,24 +60,17 @@ func (c *Module) AndroidMk() android.AndroidMkData {
|
||||||
ret := android.AndroidMkData{
|
ret := android.AndroidMkData{
|
||||||
OutputFile: c.outputFile,
|
OutputFile: c.outputFile,
|
||||||
Required: c.Properties.AndroidMkRuntimeLibs,
|
Required: c.Properties.AndroidMkRuntimeLibs,
|
||||||
|
Include: "$(BUILD_SYSTEM)/soong_cc_prebuilt.mk",
|
||||||
|
|
||||||
Extra: []android.AndroidMkExtraFunc{
|
Extra: []android.AndroidMkExtraFunc{
|
||||||
func(w io.Writer, outputFile android.Path) {
|
func(w io.Writer, outputFile android.Path) {
|
||||||
if len(c.Properties.Logtags) > 0 {
|
if len(c.Properties.Logtags) > 0 {
|
||||||
fmt.Fprintln(w, "LOCAL_LOGTAGS_FILES :=", strings.Join(c.Properties.Logtags, " "))
|
fmt.Fprintln(w, "LOCAL_LOGTAGS_FILES :=", strings.Join(c.Properties.Logtags, " "))
|
||||||
}
|
}
|
||||||
fmt.Fprintln(w, "LOCAL_SANITIZE := never")
|
|
||||||
if len(c.Properties.AndroidMkSharedLibs) > 0 {
|
if len(c.Properties.AndroidMkSharedLibs) > 0 {
|
||||||
fmt.Fprintln(w, "LOCAL_SHARED_LIBRARIES := "+strings.Join(c.Properties.AndroidMkSharedLibs, " "))
|
fmt.Fprintln(w, "LOCAL_SHARED_LIBRARIES := "+strings.Join(c.Properties.AndroidMkSharedLibs, " "))
|
||||||
}
|
}
|
||||||
if c.Target().Os == android.Android &&
|
fmt.Fprintln(w, "LOCAL_SOONG_LINK_TYPE :=", c.getMakeLinkType())
|
||||||
String(c.Properties.Sdk_version) != "" && !c.useVndk() && !c.inRecovery() {
|
|
||||||
fmt.Fprintln(w, "LOCAL_SDK_VERSION := "+String(c.Properties.Sdk_version))
|
|
||||||
fmt.Fprintln(w, "LOCAL_NDK_STL_VARIANT := none")
|
|
||||||
} else {
|
|
||||||
// These are already included in LOCAL_SHARED_LIBRARIES
|
|
||||||
fmt.Fprintln(w, "LOCAL_CXX_STL := none")
|
|
||||||
}
|
|
||||||
if c.useVndk() {
|
if c.useVndk() {
|
||||||
fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
|
fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
|
||||||
}
|
}
|
||||||
|
@ -140,44 +133,13 @@ func (library *libraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.An
|
||||||
if library.static() {
|
if library.static() {
|
||||||
ret.Class = "STATIC_LIBRARIES"
|
ret.Class = "STATIC_LIBRARIES"
|
||||||
} else if library.shared() {
|
} else if library.shared() {
|
||||||
ctx.subAndroidMk(ret, &library.stripper)
|
|
||||||
|
|
||||||
ret.Class = "SHARED_LIBRARIES"
|
ret.Class = "SHARED_LIBRARIES"
|
||||||
|
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
|
||||||
|
fmt.Fprintln(w, "LOCAL_SOONG_TOC :=", library.toc().String())
|
||||||
|
fmt.Fprintln(w, "LOCAL_SOONG_UNSTRIPPED_BINARY :=", library.unstrippedOutputFile.String())
|
||||||
|
})
|
||||||
} else if library.header() {
|
} else if library.header() {
|
||||||
ret.Custom = func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) {
|
ret.Class = "HEADER_LIBRARIES"
|
||||||
fmt.Fprintln(w, "\ninclude $(CLEAR_VARS)")
|
|
||||||
fmt.Fprintln(w, "LOCAL_PATH :=", moduleDir)
|
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE :=", name+data.SubName)
|
|
||||||
|
|
||||||
archStr := ctx.Target().Arch.ArchType.String()
|
|
||||||
var host bool
|
|
||||||
switch ctx.Target().Os.Class {
|
|
||||||
case android.Host:
|
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_HOST_ARCH := ", archStr)
|
|
||||||
host = true
|
|
||||||
case android.HostCross:
|
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_HOST_CROSS_ARCH := ", archStr)
|
|
||||||
host = true
|
|
||||||
case android.Device:
|
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_TARGET_ARCH := ", archStr)
|
|
||||||
}
|
|
||||||
|
|
||||||
if host {
|
|
||||||
makeOs := ctx.Target().Os.String()
|
|
||||||
if ctx.Target().Os == android.Linux || ctx.Target().Os == android.LinuxBionic {
|
|
||||||
makeOs = "linux"
|
|
||||||
}
|
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_HOST_OS :=", makeOs)
|
|
||||||
fmt.Fprintln(w, "LOCAL_IS_HOST_MODULE := true")
|
|
||||||
} else if ctx.useVndk() {
|
|
||||||
fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
|
|
||||||
}
|
|
||||||
|
|
||||||
library.androidMkWriteExportedFlags(w)
|
|
||||||
fmt.Fprintln(w, "include $(BUILD_HEADER_LIBRARY)")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
|
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
|
||||||
|
@ -195,8 +157,6 @@ func (library *libraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.An
|
||||||
|
|
||||||
fmt.Fprintln(w, "LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE)"+ext)
|
fmt.Fprintln(w, "LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE)"+ext)
|
||||||
|
|
||||||
fmt.Fprintln(w, "LOCAL_SYSTEM_SHARED_LIBRARIES :=")
|
|
||||||
|
|
||||||
if library.coverageOutputFile.Valid() {
|
if library.coverageOutputFile.Valid() {
|
||||||
fmt.Fprintln(w, "LOCAL_PREBUILT_COVERAGE_ARCHIVE :=", library.coverageOutputFile.String())
|
fmt.Fprintln(w, "LOCAL_PREBUILT_COVERAGE_ARCHIVE :=", library.coverageOutputFile.String())
|
||||||
}
|
}
|
||||||
|
@ -204,6 +164,10 @@ func (library *libraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.An
|
||||||
|
|
||||||
if library.shared() {
|
if library.shared() {
|
||||||
ctx.subAndroidMk(ret, library.baseInstaller)
|
ctx.subAndroidMk(ret, library.baseInstaller)
|
||||||
|
} else {
|
||||||
|
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
|
||||||
|
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,15 +182,10 @@ func (object *objectLinker) AndroidMk(ctx AndroidMkContext, ret *android.Android
|
||||||
|
|
||||||
func (binary *binaryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
|
func (binary *binaryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
|
||||||
ctx.subAndroidMk(ret, binary.baseInstaller)
|
ctx.subAndroidMk(ret, binary.baseInstaller)
|
||||||
ctx.subAndroidMk(ret, &binary.stripper)
|
|
||||||
|
|
||||||
ret.Class = "EXECUTABLES"
|
ret.Class = "EXECUTABLES"
|
||||||
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
|
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
|
||||||
fmt.Fprintln(w, "LOCAL_SYSTEM_SHARED_LIBRARIES :=")
|
fmt.Fprintln(w, "LOCAL_SOONG_UNSTRIPPED_BINARY :=", binary.unstrippedOutputFile.String())
|
||||||
if Bool(binary.Properties.Static_executable) {
|
|
||||||
fmt.Fprintln(w, "LOCAL_FORCE_STATIC_EXECUTABLE := true")
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(binary.symlinks) > 0 {
|
if len(binary.symlinks) > 0 {
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_SYMLINKS := "+strings.Join(binary.symlinks, " "))
|
fmt.Fprintln(w, "LOCAL_MODULE_SYMLINKS := "+strings.Join(binary.symlinks, " "))
|
||||||
}
|
}
|
||||||
|
@ -287,25 +246,6 @@ func (library *toolchainLibraryDecorator) AndroidMk(ctx AndroidMkContext, ret *a
|
||||||
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
|
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
|
||||||
_, suffix, _ := splitFileExt(outputFile.Base())
|
_, suffix, _ := splitFileExt(outputFile.Base())
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_SUFFIX := "+suffix)
|
fmt.Fprintln(w, "LOCAL_MODULE_SUFFIX := "+suffix)
|
||||||
fmt.Fprintln(w, "LOCAL_SYSTEM_SHARED_LIBRARIES :=")
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func (stripper *stripper) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
|
|
||||||
// Make only supports stripping target modules
|
|
||||||
if ctx.Target().Os != android.Android {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
|
|
||||||
if Bool(stripper.StripProperties.Strip.None) {
|
|
||||||
|
|
||||||
fmt.Fprintln(w, "LOCAL_STRIP_MODULE := false")
|
|
||||||
} else if Bool(stripper.StripProperties.Strip.Keep_symbols) {
|
|
||||||
fmt.Fprintln(w, "LOCAL_STRIP_MODULE := keep_symbols")
|
|
||||||
} else {
|
|
||||||
fmt.Fprintln(w, "LOCAL_STRIP_MODULE := mini-debug-info")
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +273,6 @@ func (c *stubDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkDa
|
||||||
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
|
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
|
||||||
path, file := filepath.Split(c.installPath.String())
|
path, file := filepath.Split(c.installPath.String())
|
||||||
stem, suffix, _ := splitFileExt(file)
|
stem, suffix, _ := splitFileExt(file)
|
||||||
fmt.Fprintln(w, "LOCAL_SYSTEM_SHARED_LIBRARIES :=")
|
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_SUFFIX := "+suffix)
|
fmt.Fprintln(w, "LOCAL_MODULE_SUFFIX := "+suffix)
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_PATH := "+path)
|
fmt.Fprintln(w, "LOCAL_MODULE_PATH := "+path)
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_STEM := "+stem)
|
fmt.Fprintln(w, "LOCAL_MODULE_STEM := "+stem)
|
||||||
|
@ -355,11 +294,9 @@ func (c *llndkStubDecorator) AndroidMk(ctx AndroidMkContext, ret *android.Androi
|
||||||
_, _, ext := splitFileExt(outputFile.Base())
|
_, _, ext := splitFileExt(outputFile.Base())
|
||||||
|
|
||||||
fmt.Fprintln(w, "LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE)"+ext)
|
fmt.Fprintln(w, "LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE)"+ext)
|
||||||
fmt.Fprintln(w, "LOCAL_STRIP_MODULE := false")
|
|
||||||
fmt.Fprintln(w, "LOCAL_SYSTEM_SHARED_LIBRARIES :=")
|
|
||||||
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
|
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
|
||||||
fmt.Fprintln(w, "LOCAL_NO_NOTICE_FILE := true")
|
fmt.Fprintln(w, "LOCAL_NO_NOTICE_FILE := true")
|
||||||
fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
|
fmt.Fprintln(w, "LOCAL_SOONG_TOC :=", c.toc().String())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,9 +311,6 @@ func (c *vndkPrebuiltLibraryDecorator) AndroidMk(ctx AndroidMkContext, ret *andr
|
||||||
path := c.path.RelPathString()
|
path := c.path.RelPathString()
|
||||||
dir, file := filepath.Split(path)
|
dir, file := filepath.Split(path)
|
||||||
stem, suffix, ext := splitFileExt(file)
|
stem, suffix, ext := splitFileExt(file)
|
||||||
fmt.Fprintln(w, "LOCAL_STRIP_MODULE := false")
|
|
||||||
fmt.Fprintln(w, "LOCAL_SYSTEM_SHARED_LIBRARIES :=")
|
|
||||||
fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
|
|
||||||
fmt.Fprintln(w, "LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE)"+ext)
|
fmt.Fprintln(w, "LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE)"+ext)
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_SUFFIX := "+suffix)
|
fmt.Fprintln(w, "LOCAL_MODULE_SUFFIX := "+suffix)
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_PATH := $(OUT_DIR)/"+filepath.Clean(dir))
|
fmt.Fprintln(w, "LOCAL_MODULE_PATH := $(OUT_DIR)/"+filepath.Clean(dir))
|
||||||
|
@ -404,8 +338,6 @@ func (c *vendorPublicLibraryStubDecorator) AndroidMk(ctx AndroidMkContext, ret *
|
||||||
_, _, ext := splitFileExt(outputFile.Base())
|
_, _, ext := splitFileExt(outputFile.Base())
|
||||||
|
|
||||||
fmt.Fprintln(w, "LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE)"+ext)
|
fmt.Fprintln(w, "LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE)"+ext)
|
||||||
fmt.Fprintln(w, "LOCAL_STRIP_MODULE := false")
|
|
||||||
fmt.Fprintln(w, "LOCAL_SYSTEM_SHARED_LIBRARIES :=")
|
|
||||||
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
|
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
|
||||||
fmt.Fprintln(w, "LOCAL_NO_NOTICE_FILE := true")
|
fmt.Fprintln(w, "LOCAL_NO_NOTICE_FILE := true")
|
||||||
})
|
})
|
||||||
|
|
|
@ -78,6 +78,9 @@ type binaryDecorator struct {
|
||||||
|
|
||||||
toolPath android.OptionalPath
|
toolPath android.OptionalPath
|
||||||
|
|
||||||
|
// Location of the linked, unstripped binary
|
||||||
|
unstrippedOutputFile android.Path
|
||||||
|
|
||||||
// Names of symlinks to be installed for use in LOCAL_MODULE_SYMLINKS
|
// Names of symlinks to be installed for use in LOCAL_MODULE_SYMLINKS
|
||||||
symlinks []string
|
symlinks []string
|
||||||
|
|
||||||
|
@ -306,6 +309,8 @@ func (binary *binaryDecorator) link(ctx ModuleContext,
|
||||||
binary.stripper.strip(ctx, outputFile, strippedOutputFile, builderFlags)
|
binary.stripper.strip(ctx, outputFile, strippedOutputFile, builderFlags)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
binary.unstrippedOutputFile = outputFile
|
||||||
|
|
||||||
if String(binary.Properties.Prefix_symbols) != "" {
|
if String(binary.Properties.Prefix_symbols) != "" {
|
||||||
afterPrefixSymbols := outputFile
|
afterPrefixSymbols := outputFile
|
||||||
outputFile = android.PathForModuleOut(ctx, "unprefixed", fileName)
|
outputFile = android.PathForModuleOut(ctx, "unprefixed", fileName)
|
||||||
|
|
25
cc/cc.go
25
cc/cc.go
|
@ -1177,7 +1177,7 @@ func checkLinkType(ctx android.ModuleContext, from *Module, to *Module, tag depe
|
||||||
// We can be permissive with the system "STL" since it is only the C++
|
// We can be permissive with the system "STL" since it is only the C++
|
||||||
// ABI layer, but in the future we should make sure that everyone is
|
// ABI layer, but in the future we should make sure that everyone is
|
||||||
// using either libc++ or nothing.
|
// using either libc++ or nothing.
|
||||||
} else if getNdkStlFamily(ctx, from) != getNdkStlFamily(ctx, to) {
|
} else if getNdkStlFamily(from) != getNdkStlFamily(to) {
|
||||||
ctx.ModuleErrorf("uses %q and depends on %q which uses incompatible %q",
|
ctx.ModuleErrorf("uses %q and depends on %q which uses incompatible %q",
|
||||||
from.stl.Properties.SelectedStl, ctx.OtherModuleName(to),
|
from.stl.Properties.SelectedStl, ctx.OtherModuleName(to),
|
||||||
to.stl.Properties.SelectedStl)
|
to.stl.Properties.SelectedStl)
|
||||||
|
@ -1487,6 +1487,29 @@ func (c *Module) static() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Module) getMakeLinkType() string {
|
||||||
|
if c.useVndk() {
|
||||||
|
if inList(c.Name(), vndkCoreLibraries) || inList(c.Name(), vndkSpLibraries) || inList(c.Name(), llndkLibraries) {
|
||||||
|
if inList(c.Name(), vndkPrivateLibraries) {
|
||||||
|
return "native:vndk_private"
|
||||||
|
} else {
|
||||||
|
return "native:vndk"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return "native:vendor"
|
||||||
|
}
|
||||||
|
} else if c.inRecovery() {
|
||||||
|
return "native:recovery"
|
||||||
|
} else if c.Target().Os == android.Android && String(c.Properties.Sdk_version) != "" {
|
||||||
|
return "native:ndk:none:none"
|
||||||
|
// TODO(b/114741097): use the correct ndk stl once build errors have been fixed
|
||||||
|
//family, link := getNdkStlFamilyAndLinkType(c)
|
||||||
|
//return fmt.Sprintf("native:ndk:%s:%s", family, link)
|
||||||
|
} else {
|
||||||
|
return "native:platform"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Defaults
|
// Defaults
|
||||||
//
|
//
|
||||||
|
|
|
@ -237,6 +237,9 @@ type libraryDecorator struct {
|
||||||
// not included in the NDK.
|
// not included in the NDK.
|
||||||
ndkSysrootPath android.Path
|
ndkSysrootPath android.Path
|
||||||
|
|
||||||
|
// Location of the linked, unstripped library for shared libraries
|
||||||
|
unstrippedOutputFile android.Path
|
||||||
|
|
||||||
// Decorated interafaces
|
// Decorated interafaces
|
||||||
*baseCompiler
|
*baseCompiler
|
||||||
*baseLinker
|
*baseLinker
|
||||||
|
@ -564,6 +567,8 @@ func (library *libraryDecorator) linkShared(ctx ModuleContext,
|
||||||
library.stripper.strip(ctx, outputFile, strippedOutputFile, builderFlags)
|
library.stripper.strip(ctx, outputFile, strippedOutputFile, builderFlags)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
library.unstrippedOutputFile = outputFile
|
||||||
|
|
||||||
if Bool(library.baseLinker.Properties.Use_version_lib) && ctx.Host() {
|
if Bool(library.baseLinker.Properties.Use_version_lib) && ctx.Host() {
|
||||||
versionedOutputFile := outputFile
|
versionedOutputFile := outputFile
|
||||||
outputFile = android.PathForModuleOut(ctx, "unversioned", fileName)
|
outputFile = android.PathForModuleOut(ctx, "unversioned", fileName)
|
||||||
|
|
|
@ -172,6 +172,7 @@ func NewLLndkStubLibrary() *Module {
|
||||||
libraryDecorator: library,
|
libraryDecorator: library,
|
||||||
}
|
}
|
||||||
stub.Properties.Vendor_available = BoolPtr(true)
|
stub.Properties.Vendor_available = BoolPtr(true)
|
||||||
|
module.Properties.UseVndk = true
|
||||||
module.compiler = stub
|
module.compiler = stub
|
||||||
module.linker = stub
|
module.linker = stub
|
||||||
module.installer = nil
|
module.installer = nil
|
||||||
|
|
|
@ -82,6 +82,7 @@ func (p *prebuiltLibraryLinker) link(ctx ModuleContext,
|
||||||
in := p.Prebuilt.SingleSourcePath(ctx)
|
in := p.Prebuilt.SingleSourcePath(ctx)
|
||||||
|
|
||||||
if p.shared() {
|
if p.shared() {
|
||||||
|
p.unstrippedOutputFile = in
|
||||||
libName := ctx.baseModuleName() + flags.Toolchain.ShlibSuffix()
|
libName := ctx.baseModuleName() + flags.Toolchain.ShlibSuffix()
|
||||||
if p.needsStrip(ctx) {
|
if p.needsStrip(ctx) {
|
||||||
stripped := android.PathForModuleOut(ctx, "stripped", libName)
|
stripped := android.PathForModuleOut(ctx, "stripped", libName)
|
||||||
|
@ -162,6 +163,8 @@ func (p *prebuiltBinaryLinker) link(ctx ModuleContext,
|
||||||
fileName := p.getStem(ctx) + flags.Toolchain.ExecutableSuffix()
|
fileName := p.getStem(ctx) + flags.Toolchain.ExecutableSuffix()
|
||||||
in := p.Prebuilt.SingleSourcePath(ctx)
|
in := p.Prebuilt.SingleSourcePath(ctx)
|
||||||
|
|
||||||
|
p.unstrippedOutputFile = in
|
||||||
|
|
||||||
if p.needsStrip(ctx) {
|
if p.needsStrip(ctx) {
|
||||||
stripped := android.PathForModuleOut(ctx, "stripped", fileName)
|
stripped := android.PathForModuleOut(ctx, "stripped", fileName)
|
||||||
p.strip(ctx, in, stripped, builderFlags)
|
p.strip(ctx, in, stripped, builderFlags)
|
||||||
|
|
20
cc/stl.go
20
cc/stl.go
|
@ -19,18 +19,24 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getNdkStlFamily(ctx android.ModuleContext, m *Module) string {
|
func getNdkStlFamily(m *Module) string {
|
||||||
|
family, _ := getNdkStlFamilyAndLinkType(m)
|
||||||
|
return family
|
||||||
|
}
|
||||||
|
|
||||||
|
func getNdkStlFamilyAndLinkType(m *Module) (string, string) {
|
||||||
stl := m.stl.Properties.SelectedStl
|
stl := m.stl.Properties.SelectedStl
|
||||||
switch stl {
|
switch stl {
|
||||||
case "ndk_libc++_shared", "ndk_libc++_static":
|
case "ndk_libc++_shared":
|
||||||
return "libc++"
|
return "libc++", "shared"
|
||||||
|
case "ndk_libc++_static":
|
||||||
|
return "libc++", "static"
|
||||||
case "ndk_system":
|
case "ndk_system":
|
||||||
return "system"
|
return "system", "shared"
|
||||||
case "":
|
case "":
|
||||||
return "none"
|
return "none", "none"
|
||||||
default:
|
default:
|
||||||
ctx.ModuleErrorf("stl: %q is not a valid STL", stl)
|
panic(fmt.Errorf("stl: %q is not a valid STL", stl))
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,8 @@ type stripper struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (stripper *stripper) needsStrip(ctx ModuleContext) bool {
|
func (stripper *stripper) needsStrip(ctx ModuleContext) bool {
|
||||||
return !ctx.Config().EmbeddedInMake() && !Bool(stripper.StripProperties.Strip.None)
|
// TODO(ccross): enable host stripping when embedded in make? Make never had support for stripping host binaries.
|
||||||
|
return (!ctx.Config().EmbeddedInMake() || ctx.Device()) && !Bool(stripper.StripProperties.Strip.None)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (stripper *stripper) strip(ctx ModuleContext, in android.Path, out android.ModuleOutPath,
|
func (stripper *stripper) strip(ctx ModuleContext, in android.Path, out android.ModuleOutPath,
|
||||||
|
|
|
@ -149,6 +149,7 @@ func vndkPrebuiltSharedLibrary() *Module {
|
||||||
module.stl = nil
|
module.stl = nil
|
||||||
module.sanitize = nil
|
module.sanitize = nil
|
||||||
library.StripProperties.Strip.None = BoolPtr(true)
|
library.StripProperties.Strip.None = BoolPtr(true)
|
||||||
|
module.Properties.UseVndk = true
|
||||||
|
|
||||||
prebuilt := &vndkPrebuiltLibraryDecorator{
|
prebuilt := &vndkPrebuiltLibraryDecorator{
|
||||||
libraryDecorator: library,
|
libraryDecorator: library,
|
||||||
|
|
Loading…
Reference in New Issue