Merge changes Ia7e7fb61,Iede67e2c
* changes: androidmk: Fix LOCAL_FORCE_STATIC_EXECUTABLE Implement re-exporting of library headers
This commit is contained in:
@@ -32,23 +32,25 @@ var standardProperties = map[string]struct {
|
|||||||
"LOCAL_MODULE_RELATIVE_PATH": {"relative_install_path", bpparser.String},
|
"LOCAL_MODULE_RELATIVE_PATH": {"relative_install_path", bpparser.String},
|
||||||
|
|
||||||
// List properties
|
// List properties
|
||||||
"LOCAL_SRC_FILES_EXCLUDE": {"exclude_srcs", bpparser.List},
|
"LOCAL_SRC_FILES_EXCLUDE": {"exclude_srcs", bpparser.List},
|
||||||
"LOCAL_SHARED_LIBRARIES": {"shared_libs", bpparser.List},
|
"LOCAL_SHARED_LIBRARIES": {"shared_libs", bpparser.List},
|
||||||
"LOCAL_STATIC_LIBRARIES": {"static_libs", bpparser.List},
|
"LOCAL_STATIC_LIBRARIES": {"static_libs", bpparser.List},
|
||||||
"LOCAL_WHOLE_STATIC_LIBRARIES": {"whole_static_libs", bpparser.List},
|
"LOCAL_WHOLE_STATIC_LIBRARIES": {"whole_static_libs", bpparser.List},
|
||||||
"LOCAL_SYSTEM_SHARED_LIBRARIES": {"system_shared_libs", bpparser.List},
|
"LOCAL_SYSTEM_SHARED_LIBRARIES": {"system_shared_libs", bpparser.List},
|
||||||
"LOCAL_ASFLAGS": {"asflags", bpparser.List},
|
"LOCAL_ASFLAGS": {"asflags", bpparser.List},
|
||||||
"LOCAL_CLANG_ASFLAGS": {"clang_asflags", bpparser.List},
|
"LOCAL_CLANG_ASFLAGS": {"clang_asflags", bpparser.List},
|
||||||
"LOCAL_CFLAGS": {"cflags", bpparser.List},
|
"LOCAL_CFLAGS": {"cflags", bpparser.List},
|
||||||
"LOCAL_CONLYFLAGS": {"conlyflags", bpparser.List},
|
"LOCAL_CONLYFLAGS": {"conlyflags", bpparser.List},
|
||||||
"LOCAL_CPPFLAGS": {"cppflags", bpparser.List},
|
"LOCAL_CPPFLAGS": {"cppflags", bpparser.List},
|
||||||
"LOCAL_REQUIRED_MODULES": {"required", bpparser.List},
|
"LOCAL_REQUIRED_MODULES": {"required", bpparser.List},
|
||||||
"LOCAL_MODULE_TAGS": {"tags", bpparser.List},
|
"LOCAL_MODULE_TAGS": {"tags", bpparser.List},
|
||||||
"LOCAL_LDLIBS": {"host_ldlibs", bpparser.List},
|
"LOCAL_LDLIBS": {"host_ldlibs", bpparser.List},
|
||||||
"LOCAL_CLANG_CFLAGS": {"clang_cflags", bpparser.List},
|
"LOCAL_CLANG_CFLAGS": {"clang_cflags", bpparser.List},
|
||||||
"LOCAL_YACCFLAGS": {"yaccflags", bpparser.List},
|
"LOCAL_YACCFLAGS": {"yaccflags", bpparser.List},
|
||||||
"LOCAL_SANITIZE_RECOVER": {"sanitize.recover", bpparser.List},
|
"LOCAL_SANITIZE_RECOVER": {"sanitize.recover", bpparser.List},
|
||||||
"LOCAL_LOGTAGS_FILES": {"logtags", bpparser.List},
|
"LOCAL_LOGTAGS_FILES": {"logtags", bpparser.List},
|
||||||
|
"LOCAL_EXPORT_SHARED_LIBRARY_HEADERS": {"export_shared_lib_headers", bpparser.List},
|
||||||
|
"LOCAL_EXPORT_STATIC_LIBRARY_HEADERS": {"export_static_lib_headers", bpparser.List},
|
||||||
|
|
||||||
"LOCAL_JAVA_RESOURCE_DIRS": {"java_resource_dirs", bpparser.List},
|
"LOCAL_JAVA_RESOURCE_DIRS": {"java_resource_dirs", bpparser.List},
|
||||||
"LOCAL_JAVACFLAGS": {"javacflags", bpparser.List},
|
"LOCAL_JAVACFLAGS": {"javacflags", bpparser.List},
|
||||||
@@ -62,7 +64,7 @@ var standardProperties = map[string]struct {
|
|||||||
// Bool properties
|
// Bool properties
|
||||||
"LOCAL_IS_HOST_MODULE": {"host", bpparser.Bool},
|
"LOCAL_IS_HOST_MODULE": {"host", bpparser.Bool},
|
||||||
"LOCAL_CLANG": {"clang", bpparser.Bool},
|
"LOCAL_CLANG": {"clang", bpparser.Bool},
|
||||||
"LOCAL_FORCE_STATIC_EXECUTABLE": {"static", bpparser.Bool},
|
"LOCAL_FORCE_STATIC_EXECUTABLE": {"static_executable", bpparser.Bool},
|
||||||
"LOCAL_NATIVE_COVERAGE": {"native_coverage", bpparser.Bool},
|
"LOCAL_NATIVE_COVERAGE": {"native_coverage", bpparser.Bool},
|
||||||
"LOCAL_NO_CRT": {"nocrt", bpparser.Bool},
|
"LOCAL_NO_CRT": {"nocrt", bpparser.Bool},
|
||||||
"LOCAL_ALLOW_UNDEFINED_SYMBOLS": {"allow_undefined_symbols", bpparser.Bool},
|
"LOCAL_ALLOW_UNDEFINED_SYMBOLS": {"allow_undefined_symbols", bpparser.Bool},
|
||||||
|
87
cc/cc.go
87
cc/cc.go
@@ -182,6 +182,8 @@ type Deps struct {
|
|||||||
SharedLibs, LateSharedLibs []string
|
SharedLibs, LateSharedLibs []string
|
||||||
StaticLibs, LateStaticLibs, WholeStaticLibs []string
|
StaticLibs, LateStaticLibs, WholeStaticLibs []string
|
||||||
|
|
||||||
|
ReexportSharedLibHeaders, ReexportStaticLibHeaders []string
|
||||||
|
|
||||||
ObjFiles []string
|
ObjFiles []string
|
||||||
|
|
||||||
GeneratedSources []string
|
GeneratedSources []string
|
||||||
@@ -327,6 +329,14 @@ type BaseLinkerProperties struct {
|
|||||||
|
|
||||||
// -l arguments to pass to linker for host-provided shared libraries
|
// -l arguments to pass to linker for host-provided shared libraries
|
||||||
Host_ldlibs []string `android:"arch_variant"`
|
Host_ldlibs []string `android:"arch_variant"`
|
||||||
|
|
||||||
|
// list of shared libraries to re-export include directories from. Entries must be
|
||||||
|
// present in shared_libs.
|
||||||
|
Export_shared_lib_headers []string `android:"arch_variant"`
|
||||||
|
|
||||||
|
// list of static libraries to re-export include directories from. Entries must be
|
||||||
|
// present in static_libs.
|
||||||
|
Export_static_lib_headers []string `android:"arch_variant"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type LibraryCompilerProperties struct {
|
type LibraryCompilerProperties struct {
|
||||||
@@ -493,20 +503,24 @@ type dependencyTag struct {
|
|||||||
blueprint.BaseDependencyTag
|
blueprint.BaseDependencyTag
|
||||||
name string
|
name string
|
||||||
library bool
|
library bool
|
||||||
|
|
||||||
|
reexportFlags bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
sharedDepTag = dependencyTag{name: "shared", library: true}
|
sharedDepTag = dependencyTag{name: "shared", library: true}
|
||||||
lateSharedDepTag = dependencyTag{name: "late shared", library: true}
|
sharedExportDepTag = dependencyTag{name: "shared", library: true, reexportFlags: true}
|
||||||
staticDepTag = dependencyTag{name: "static", library: true}
|
lateSharedDepTag = dependencyTag{name: "late shared", library: true}
|
||||||
lateStaticDepTag = dependencyTag{name: "late static", library: true}
|
staticDepTag = dependencyTag{name: "static", library: true}
|
||||||
wholeStaticDepTag = dependencyTag{name: "whole static", library: true}
|
staticExportDepTag = dependencyTag{name: "static", library: true, reexportFlags: true}
|
||||||
genSourceDepTag = dependencyTag{name: "gen source"}
|
lateStaticDepTag = dependencyTag{name: "late static", library: true}
|
||||||
genHeaderDepTag = dependencyTag{name: "gen header"}
|
wholeStaticDepTag = dependencyTag{name: "whole static", library: true, reexportFlags: true}
|
||||||
objDepTag = dependencyTag{name: "obj"}
|
genSourceDepTag = dependencyTag{name: "gen source"}
|
||||||
crtBeginDepTag = dependencyTag{name: "crtbegin"}
|
genHeaderDepTag = dependencyTag{name: "gen header"}
|
||||||
crtEndDepTag = dependencyTag{name: "crtend"}
|
objDepTag = dependencyTag{name: "obj"}
|
||||||
reuseObjTag = dependencyTag{name: "reuse objects"}
|
crtBeginDepTag = dependencyTag{name: "crtbegin"}
|
||||||
|
crtEndDepTag = dependencyTag{name: "crtend"}
|
||||||
|
reuseObjTag = dependencyTag{name: "reuse objects"}
|
||||||
)
|
)
|
||||||
|
|
||||||
// Module contains the properties and members used by all C/C++ module types, and implements
|
// Module contains the properties and members used by all C/C++ module types, and implements
|
||||||
@@ -783,6 +797,18 @@ func (c *Module) deps(ctx BaseModuleContext) Deps {
|
|||||||
deps.SharedLibs = lastUniqueElements(deps.SharedLibs)
|
deps.SharedLibs = lastUniqueElements(deps.SharedLibs)
|
||||||
deps.LateSharedLibs = lastUniqueElements(deps.LateSharedLibs)
|
deps.LateSharedLibs = lastUniqueElements(deps.LateSharedLibs)
|
||||||
|
|
||||||
|
for _, lib := range deps.ReexportSharedLibHeaders {
|
||||||
|
if !inList(lib, deps.SharedLibs) {
|
||||||
|
ctx.PropertyErrorf("export_shared_lib_headers", "Shared library not in shared_libs: '%s'", lib)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, lib := range deps.ReexportStaticLibHeaders {
|
||||||
|
if !inList(lib, deps.StaticLibs) {
|
||||||
|
ctx.PropertyErrorf("export_static_lib_headers", "Static library not in static_libs: '%s'", lib)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return deps
|
return deps
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -808,14 +834,26 @@ func (c *Module) depsMutator(actx android.BottomUpMutatorContext) {
|
|||||||
actx.AddVariationDependencies([]blueprint.Variation{{"link", "static"}}, wholeStaticDepTag,
|
actx.AddVariationDependencies([]blueprint.Variation{{"link", "static"}}, wholeStaticDepTag,
|
||||||
deps.WholeStaticLibs...)
|
deps.WholeStaticLibs...)
|
||||||
|
|
||||||
actx.AddVariationDependencies([]blueprint.Variation{{"link", "static"}}, staticDepTag,
|
for _, lib := range deps.StaticLibs {
|
||||||
deps.StaticLibs...)
|
depTag := staticDepTag
|
||||||
|
if inList(lib, deps.ReexportStaticLibHeaders) {
|
||||||
|
depTag = staticExportDepTag
|
||||||
|
}
|
||||||
|
actx.AddVariationDependencies([]blueprint.Variation{{"link", "static"}}, depTag,
|
||||||
|
deps.StaticLibs...)
|
||||||
|
}
|
||||||
|
|
||||||
actx.AddVariationDependencies([]blueprint.Variation{{"link", "static"}}, lateStaticDepTag,
|
actx.AddVariationDependencies([]blueprint.Variation{{"link", "static"}}, lateStaticDepTag,
|
||||||
deps.LateStaticLibs...)
|
deps.LateStaticLibs...)
|
||||||
|
|
||||||
actx.AddVariationDependencies([]blueprint.Variation{{"link", "shared"}}, sharedDepTag,
|
for _, lib := range deps.SharedLibs {
|
||||||
deps.SharedLibs...)
|
depTag := sharedDepTag
|
||||||
|
if inList(lib, deps.ReexportSharedLibHeaders) {
|
||||||
|
depTag = sharedExportDepTag
|
||||||
|
}
|
||||||
|
actx.AddVariationDependencies([]blueprint.Variation{{"link", "shared"}}, depTag,
|
||||||
|
deps.SharedLibs...)
|
||||||
|
}
|
||||||
|
|
||||||
actx.AddVariationDependencies([]blueprint.Variation{{"link", "shared"}}, lateSharedDepTag,
|
actx.AddVariationDependencies([]blueprint.Variation{{"link", "shared"}}, lateSharedDepTag,
|
||||||
deps.LateSharedLibs...)
|
deps.LateSharedLibs...)
|
||||||
@@ -925,28 +963,30 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var cflags []string
|
if t, ok := tag.(dependencyTag); ok && t.library {
|
||||||
if t, _ := tag.(dependencyTag); t.library {
|
|
||||||
if i, ok := c.linker.(exportedFlagsProducer); ok {
|
if i, ok := c.linker.(exportedFlagsProducer); ok {
|
||||||
cflags = i.exportedFlags()
|
cflags := i.exportedFlags()
|
||||||
depPaths.Cflags = append(depPaths.Cflags, cflags...)
|
depPaths.Cflags = append(depPaths.Cflags, cflags...)
|
||||||
|
|
||||||
|
if t.reexportFlags {
|
||||||
|
depPaths.ReexportedCflags = append(depPaths.ReexportedCflags, cflags...)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var depPtr *android.Paths
|
var depPtr *android.Paths
|
||||||
|
|
||||||
switch tag {
|
switch tag {
|
||||||
case sharedDepTag:
|
case sharedDepTag, sharedExportDepTag:
|
||||||
depPtr = &depPaths.SharedLibs
|
depPtr = &depPaths.SharedLibs
|
||||||
case lateSharedDepTag:
|
case lateSharedDepTag:
|
||||||
depPtr = &depPaths.LateSharedLibs
|
depPtr = &depPaths.LateSharedLibs
|
||||||
case staticDepTag:
|
case staticDepTag, staticExportDepTag:
|
||||||
depPtr = &depPaths.StaticLibs
|
depPtr = &depPaths.StaticLibs
|
||||||
case lateStaticDepTag:
|
case lateStaticDepTag:
|
||||||
depPtr = &depPaths.LateStaticLibs
|
depPtr = &depPaths.LateStaticLibs
|
||||||
case wholeStaticDepTag:
|
case wholeStaticDepTag:
|
||||||
depPtr = &depPaths.WholeStaticLibs
|
depPtr = &depPaths.WholeStaticLibs
|
||||||
depPaths.ReexportedCflags = append(depPaths.ReexportedCflags, cflags...)
|
|
||||||
staticLib, _ := c.linker.(*libraryLinker)
|
staticLib, _ := c.linker.(*libraryLinker)
|
||||||
if staticLib == nil || !staticLib.static() {
|
if staticLib == nil || !staticLib.static() {
|
||||||
ctx.ModuleErrorf("module %q not a static library", ctx.OtherModuleName(m))
|
ctx.ModuleErrorf("module %q not a static library", ctx.OtherModuleName(m))
|
||||||
@@ -969,7 +1009,7 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
case crtEndDepTag:
|
case crtEndDepTag:
|
||||||
depPaths.CrtEnd = c.outputFile
|
depPaths.CrtEnd = c.outputFile
|
||||||
default:
|
default:
|
||||||
panic(fmt.Errorf("unknown dependency tag: %s", ctx.OtherModuleDependencyTag(m)))
|
panic(fmt.Errorf("unknown dependency tag: %s", tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
if depPtr != nil {
|
if depPtr != nil {
|
||||||
@@ -1223,6 +1263,9 @@ func (linker *baseLinker) deps(ctx BaseModuleContext, deps Deps) Deps {
|
|||||||
deps.StaticLibs = append(deps.StaticLibs, linker.Properties.Static_libs...)
|
deps.StaticLibs = append(deps.StaticLibs, linker.Properties.Static_libs...)
|
||||||
deps.SharedLibs = append(deps.SharedLibs, linker.Properties.Shared_libs...)
|
deps.SharedLibs = append(deps.SharedLibs, linker.Properties.Shared_libs...)
|
||||||
|
|
||||||
|
deps.ReexportStaticLibHeaders = append(deps.ReexportStaticLibHeaders, linker.Properties.Export_static_lib_headers...)
|
||||||
|
deps.ReexportSharedLibHeaders = append(deps.ReexportSharedLibHeaders, linker.Properties.Export_shared_lib_headers...)
|
||||||
|
|
||||||
if ctx.ModuleName() != "libcompiler_rt-extras" {
|
if ctx.ModuleName() != "libcompiler_rt-extras" {
|
||||||
deps.StaticLibs = append(deps.StaticLibs, "libcompiler_rt-extras")
|
deps.StaticLibs = append(deps.StaticLibs, "libcompiler_rt-extras")
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user