Merge "Add prebuilt ABI checker support to soong"

am: f1b3352b97

Change-Id: I38b6006e3107944826c31bcfb2052b830bff3cd0
This commit is contained in:
Logan Chien 2019-01-22 23:26:19 -08:00 committed by android-build-merger
commit 9839dd76c3
4 changed files with 50 additions and 0 deletions

View file

@ -195,6 +195,8 @@ type productVariables struct {
Arc *bool `json:",omitempty"`
MinimizeJavaDebugInfo *bool `json:",omitempty"`
Check_elf_files *bool `json:",omitempty"`
UncompressPrivAppDex *bool `json:",omitempty"`
ModulesLoadedByPrivilegedModules []string `json:",omitempty"`

View file

@ -362,3 +362,40 @@ func (c *vendorPublicLibraryStubDecorator) AndroidMk(ctx AndroidMkContext, ret *
fmt.Fprintln(w, "LOCAL_NO_NOTICE_FILE := true")
})
}
func (p *prebuiltLinker) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
if p.properties.Check_elf_files != nil {
fmt.Fprintln(w, "LOCAL_CHECK_ELF_FILES :=", *p.properties.Check_elf_files)
} else {
// soong_cc_prebuilt.mk does not include check_elf_file.mk by default
// because cc_library_shared and cc_binary use soong_cc_prebuilt.mk as well.
// In order to turn on prebuilt ABI checker, set `LOCAL_CHECK_ELF_FILES` to
// true if `p.properties.Check_elf_files` is not specified.
fmt.Fprintln(w, "LOCAL_CHECK_ELF_FILES := true")
}
})
}
func (p *prebuiltLibraryLinker) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
ctx.subAndroidMk(ret, p.libraryDecorator)
if p.shared() {
ctx.subAndroidMk(ret, &p.prebuiltLinker)
androidMkWriteAllowUndefinedSymbols(p.baseLinker, ret)
}
}
func (p *prebuiltBinaryLinker) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
ctx.subAndroidMk(ret, p.binaryDecorator)
ctx.subAndroidMk(ret, &p.prebuiltLinker)
androidMkWriteAllowUndefinedSymbols(p.baseLinker, ret)
}
func androidMkWriteAllowUndefinedSymbols(linker *baseLinker, ret *android.AndroidMkData) {
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
allow := linker.Properties.Allow_undefined_symbols
if allow != nil {
fmt.Fprintln(w, "LOCAL_ALLOW_UNDEFINED_SYMBOLS :=", *allow)
}
})
}

View file

@ -31,8 +31,13 @@ type prebuiltLinkerInterface interface {
type prebuiltLinker struct {
android.Prebuilt
properties struct {
Srcs []string `android:"arch_variant"`
// Check the prebuilt ELF files (e.g. DT_SONAME, DT_NEEDED, resolution of undefined
// symbols, etc), default true.
Check_elf_files *bool
}
}

View file

@ -60,6 +60,10 @@ type vndkPrebuiltProperties struct {
// Prebuilt files for each arch.
Srcs []string `android:"arch_variant"`
// Check the prebuilt ELF files (e.g. DT_SONAME, DT_NEEDED, resolution of undefined symbols,
// etc).
Check_elf_files *bool
}
type vndkPrebuiltLibraryDecorator struct {
@ -155,6 +159,8 @@ func vndkPrebuiltSharedLibrary() *Module {
libraryDecorator: library,
}
prebuilt.properties.Check_elf_files = BoolPtr(false)
module.compiler = nil
module.linker = prebuilt
module.installer = prebuilt