Merge "Fix note_memtag bionic libraries in mixed builds" am: b7c6a7ef36
am: 27798cb5d6
am: ff2a9c6ada
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1663541 Change-Id: I0d248d953a3a9463c5eb87ed37e5c9e4dd156c7b
This commit is contained in:
commit
6c025c3929
|
@ -174,8 +174,6 @@ var (
|
||||||
"liblinker_debuggerd_stub", // ruperts@, cc_library_static, depends on //system/libbase
|
"liblinker_debuggerd_stub", // ruperts@, cc_library_static, depends on //system/libbase
|
||||||
"libbionic_tests_headers_posix", // ruperts@, cc_library_static
|
"libbionic_tests_headers_posix", // ruperts@, cc_library_static
|
||||||
"libc_dns", // ruperts@, cc_library_static
|
"libc_dns", // ruperts@, cc_library_static
|
||||||
"note_memtag_heap_async", // cparsons@, cc_library_static
|
|
||||||
"note_memtag_heap_sync", // cparsons@, cc_library_static
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used for quicker lookups
|
// Used for quicker lookups
|
||||||
|
|
|
@ -78,7 +78,17 @@ func (g getOutputFilesAndCcObjectFilesType) ParseResult(rawString string) interf
|
||||||
splitString := strings.Split(rawString, "|")
|
splitString := strings.Split(rawString, "|")
|
||||||
outputFilesString := splitString[0]
|
outputFilesString := splitString[0]
|
||||||
ccObjectsString := splitString[1]
|
ccObjectsString := splitString[1]
|
||||||
outputFiles = strings.Split(outputFilesString, ", ")
|
outputFiles = splitOrEmpty(outputFilesString, ", ")
|
||||||
ccObjects = strings.Split(ccObjectsString, ", ")
|
ccObjects = splitOrEmpty(ccObjectsString, ", ")
|
||||||
return GetOutputFilesAndCcObjectFiles_Result{outputFiles, ccObjects}
|
return GetOutputFilesAndCcObjectFiles_Result{outputFiles, ccObjects}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// splitOrEmpty is a modification of strings.Split() that returns an empty list
|
||||||
|
// if the given string is empty.
|
||||||
|
func splitOrEmpty(s string, sep string) []string {
|
||||||
|
if len(s) < 1 {
|
||||||
|
return []string{}
|
||||||
|
} else {
|
||||||
|
return strings.Split(s, sep)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
4
cc/cc.go
4
cc/cc.go
|
@ -1646,12 +1646,12 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
|
||||||
c.hideApexVariantFromMake = true
|
c.hideApexVariantFromMake = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.makeLinkType = GetMakeLinkType(actx, c)
|
||||||
|
|
||||||
if c.maybeGenerateBazelActions(actx) {
|
if c.maybeGenerateBazelActions(actx) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.makeLinkType = GetMakeLinkType(actx, c)
|
|
||||||
|
|
||||||
ctx := &moduleContext{
|
ctx := &moduleContext{
|
||||||
ModuleContext: actx,
|
ModuleContext: actx,
|
||||||
moduleContextImpl: moduleContextImpl{
|
moduleContextImpl: moduleContextImpl{
|
||||||
|
|
|
@ -425,11 +425,14 @@ func (handler *staticLibraryBazelHandler) generateBazelBuildActions(ctx android.
|
||||||
if !ok {
|
if !ok {
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
if len(outputPaths) != 1 {
|
if len(outputPaths) > 1 {
|
||||||
// TODO(cparsons): This is actually expected behavior for static libraries with no srcs.
|
// TODO(cparsons): This is actually expected behavior for static libraries with no srcs.
|
||||||
// We should support this.
|
// We should support this.
|
||||||
ctx.ModuleErrorf("expected exactly one output file for '%s', but got %s", label, objPaths)
|
ctx.ModuleErrorf("expected at most one output file for '%s', but got %s", label, objPaths)
|
||||||
return false
|
return false
|
||||||
|
} else if len(outputPaths) == 0 {
|
||||||
|
handler.module.outputFile = android.OptionalPath{}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
outputFilePath := android.PathForBazelOut(ctx, outputPaths[0])
|
outputFilePath := android.PathForBazelOut(ctx, outputPaths[0])
|
||||||
handler.module.outputFile = android.OptionalPathForPath(outputFilePath)
|
handler.module.outputFile = android.OptionalPathForPath(outputFilePath)
|
||||||
|
@ -453,7 +456,15 @@ func (handler *staticLibraryBazelHandler) generateBazelBuildActions(ctx android.
|
||||||
Direct(outputFilePath).
|
Direct(outputFilePath).
|
||||||
Build(),
|
Build(),
|
||||||
})
|
})
|
||||||
handler.module.outputFile = android.OptionalPathForPath(android.PathForBazelOut(ctx, objPaths[0]))
|
if i, ok := handler.module.linker.(snapshotLibraryInterface); ok {
|
||||||
|
// Dependencies on this library will expect collectedSnapshotHeaders to
|
||||||
|
// be set, otherwise validation will fail. For now, set this to an empty
|
||||||
|
// list.
|
||||||
|
// TODO(cparsons): More closely mirror the collectHeadersForSnapshot
|
||||||
|
// implementation.
|
||||||
|
i.(*libraryDecorator).collectedSnapshotHeaders = android.Paths{}
|
||||||
|
}
|
||||||
|
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue