Lines Matching refs:library
101 // vendor variant of this library. This will overwrite
126 module, library := NewLibrary(android.HostAndDeviceSupported)
127 library.BuildOnlyStatic()
133 module, library := NewLibrary(android.HostAndDeviceSupported)
134 library.BuildOnlyShared()
140 module, library := NewLibrary(android.HostSupported)
141 library.BuildOnlyStatic()
147 module, library := NewLibrary(android.HostSupported)
148 library.BuildOnlyShared()
154 module, library := NewLibrary(android.HostAndDeviceSupported)
155 library.HeaderOnly()
204 // libraryDecorator wraps baseCompiler, baseLinker and baseInstaller to provide library-specific
210 // For reusing static library objects for shared library
246 // Location of the static library in the sysroot. Empty if the library is
256 func (library *libraryDecorator) linkerProps() []interface{} {
258 props = append(props, library.baseLinker.linkerProps()...)
260 &library.Properties,
261 &library.MutatedProperties,
262 &library.flagExporter.Properties,
263 &library.stripper.StripProperties,
264 &library.relocationPacker.Properties)
267 func (library *libraryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags {
268 flags = library.baseLinker.linkerFlags(ctx, flags)
277 if library.static() {
278 flags.CFlags = append(flags.CFlags, library.Properties.Static.Cflags...)
279 } else if library.shared() {
280 flags.CFlags = append(flags.CFlags, library.Properties.Shared.Cflags...)
283 if library.shared() {
284 libName := library.getLibName(ctx)
321 func (library *libraryDecorator) compilerFlags(ctx ModuleContext, flags Flags, deps PathDeps) Flags {
322 exportIncludeDirs := library.flagExporter.exportedIncludes(ctx)
329 return library.baseCompiler.compilerFlags(ctx, flags, deps)
335 // abi exported by a library and filter out the rest of the abi dumped
336 // from a source. We extract the include flags exported by a library.
338 // library dependencies, exported header library dependencies and
351 func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects {
352 if !library.buildShared() && !library.buildStatic() {
353 if len(library.baseCompiler.Properties.Srcs) > 0 {
356 if len(library.Properties.Static.Srcs) > 0 {
359 if len(library.Properties.Shared.Srcs) > 0 {
364 if ctx.createVndkSourceAbiDump() || library.sabi.Properties.CreateSAbiDumps {
365 exportIncludeDirs := library.flagExporter.exportedIncludes(ctx)
370 for _, reexportedInclude := range extractExportIncludesFromFlags(library.sabi.Properties.ReexportedIncludeFlags) {
374 total_length := len(library.baseCompiler.Properties.Srcs) + len(deps.GeneratedSources) + len(library.Properties.Shared.Srcs) +
375 len(library.Properties.Static.Srcs)
380 objs := library.baseCompiler.compile(ctx, flags, deps)
381 library.reuseObjects = objs
384 if library.static() {
385 srcs := android.PathsForModuleSrc(ctx, library.Properties.Static.Srcs)
387 srcs, library.baseCompiler.pathDeps, library.baseCompiler.cFlagsDeps))
388 } else if library.shared() {
389 srcs := android.PathsForModuleSrc(ctx, library.Properties.Shared.Srcs)
391 srcs, library.baseCompiler.pathDeps, library.baseCompiler.cFlagsDeps))
413 func (library *libraryDecorator) getLibName(ctx ModuleContext) string {
414 name := library.libName
423 if ctx.Host() && Bool(library.Properties.Unique_host_soname) {
429 return name + library.MutatedProperties.VariantName
432 func (library *libraryDecorator) linkerInit(ctx BaseModuleContext) {
434 if library.sanitize.inSanitizerDir() {
437 library.baseInstaller.location = location
439 library.baseLinker.linkerInit(ctx)
441 library.relocationPacker.packingInit(ctx)
444 func (library *libraryDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
445 deps = library.baseLinker.linkerDeps(ctx, deps)
447 if library.static() {
449 library.Properties.Static.Whole_static_libs...)
450 deps.StaticLibs = append(deps.StaticLibs, library.Properties.Static.Static_libs...)
451 deps.SharedLibs = append(deps.SharedLibs, library.Properties.Static.Shared_libs...)
452 } else if library.shared() {
453 if ctx.toolchain().Bionic() && !Bool(library.baseLinker.Properties.Nocrt) {
470 deps.WholeStaticLibs = append(deps.WholeStaticLibs, library.Properties.Shared.Whole_static_libs...)
471 deps.StaticLibs = append(deps.StaticLibs, library.Properties.Shared.Static_libs...)
472 deps.SharedLibs = append(deps.SharedLibs, library.Properties.Shared.Shared_libs...)
475 deps.WholeStaticLibs = removeListFromList(deps.WholeStaticLibs, library.baseLinker.Properties.Target.Vendor.Exclude_static_libs)
476 deps.SharedLibs = removeListFromList(deps.SharedLibs, library.baseLinker.Properties.Target.Vendor.Exclude_shared_libs)
477 deps.StaticLibs = removeListFromList(deps.StaticLibs, library.baseLinker.Properties.Target.Vendor.Exclude_static_libs)
480 android.ExtractSourceDeps(ctx, library.Properties.Version_script)
481 android.ExtractSourceDeps(ctx, library.Properties.Unexported_symbols_list)
482 android.ExtractSourceDeps(ctx, library.Properties.Force_symbols_not_weak_list)
483 android.ExtractSourceDeps(ctx, library.Properties.Force_symbols_weak_list)
484 android.ExtractSourceDeps(ctx, library.Properties.Target.Vendor.Version_script)
489 func (library *libraryDecorator) linkStatic(ctx ModuleContext,
492 library.objects = deps.WholeStaticLibObjs.Copy()
493 library.objects = library.objects.Append(objs)
495 fileName := ctx.ModuleName() + library.MutatedProperties.VariantName + staticLibraryExtension
499 if Bool(library.baseLinker.Properties.Use_version_lib) && ctx.Host() {
502 library
505 TransformObjToStaticLib(ctx, library.objects.objFiles, builderFlags, outputFile, objs.tidyFiles)
507 library.coverageOutputFile = TransformCoverageFilesToLib(ctx, library.objects, builderFlags,
508 ctx.ModuleName()+library.MutatedProperties.VariantName)
510 library.wholeStaticMissingDeps = ctx.GetMissingDependencies()
517 func (library *libraryDecorator) linkShared(ctx ModuleContext,
523 versionScript := ctx.ExpandOptionalSource(library.Properties.Version_script, "version_script")
524 unexportedSymbols := ctx.ExpandOptionalSource(library.Properties.Unexported_symbols_list, "unexported_symbols_list")
525 forceNotWeakSymbols := ctx.ExpandOptionalSource(library.Properties.Force_symbols_not_weak_list, "force_symbols_not_weak_list")
526 forceWeakSymbols := ctx.ExpandOptionalSource(library.Properties.Force_symbols_weak_list, "force_symbols_weak_list")
527 if ctx.useVndk() && library.Properties.Target.Vendor.Version_script != nil {
528 versionScript = ctx.ExpandOptionalSource(library.Properties.Target.Vendor.Version_script, "target.vendor.version_script")
534 if library.sanitize.isSanitizerEnabled(cfi) {
567 fileName := library.getLibName(ctx) + flags.Toolchain.ShlibSuffix()
575 // depending on a table of contents file instead of the library itself.
579 library.tocFile = android.OptionalPathForPath(tocFile)
583 if library.relocationPacker.needsPacking(ctx) {
586 library.relocationPacker.pack(ctx, outputFile, packedOutputFile, builderFlags)
589 if library.stripper.needsStrip(ctx) {
592 library.stripper.strip(ctx, outputFile, strippedOutputFile, builderFlags)
595 if Bool(library.baseLinker.Properties.Use_version_lib) && ctx.Host() {
598 library.injectVersionSymbol(ctx, outputFile, versionedOutputFile)
637 library.coverageOutputFile = TransformCoverageFilesToLib(ctx, objs, builderFlags, library.getLibName(ctx))
638 library.linkSAbiDumpFiles(ctx, objs, fileName, ret)
643 func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objects, fileName string, soFile android.Path) {
652 exportIncludeDirs := library.flagExporter.exportedIncludes(ctx)
657 for _, reexportedInclude := range extractExportIncludesFromFlags(library.sabi.Properties.ReexportedIncludeFlags) {
661 library.sAbiOutputFile = TransformDumpToLinkedDump(ctx, objs.sAbiDumpFiles, soFile, fileName, exportedHeaderFlags)
664 library.sAbiDiff = SourceAbiDiff(ctx, library.sAbiOutputFile.Path(),
677 func (library *libraryDecorator) link(ctx ModuleContext,
682 if library.static() || library.header() {
683 out = library.linkStatic(ctx, flags, deps, objs)
685 out = library.linkShared(ctx, flags, deps, objs)
688 library.exportIncludes(ctx, "-I")
689 library.reexportFlags(deps.ReexportedFlags)
690 library.reexportDeps(deps.ReexportedFlagsDeps)
692 if Bool(library.Properties.Aidl.Export_aidl_headers) {
693 if library.baseCompiler.hasSrcExt(".aidl") {
697 library.reexportFlags(flags)
698 library.reuseExportedFlags = append(library.reuseExportedFlags, flags...)
699 library.reexportDeps(library.baseCompiler.pathDeps) // TODO: restrict to aidl deps
700 library.reuseExportedDeps = append(library.reuseExportedDeps, library.baseCompiler.pathDeps...)
704 if Bool(library.Properties.Proto.Export_proto_headers) {
705 if library.baseCompiler.hasSrcExt(".proto") {
711 library.reexportFlags(includes)
712 library.reuseExportedFlags = append(library.reuseExportedFlags, includes...)
713 library.reexportDeps(library.baseCompiler.pathDeps) // TODO: restrict to proto deps
714 library.reuseExportedDeps = append(library.reuseExportedDeps, library.baseCompiler.pathDeps...)
721 func (library *libraryDecorator) buildStatic() bool {
722 return library.MutatedProperties.BuildStatic &&
723 (library.Properties.Static.Enabled == nil || *library.Properties.Static.Enabled)
726 func (library *libraryDecorator) buildShared() bool {
727 return library.MutatedProperties.BuildShared &&
728 (library.Properties.Shared.Enabled == nil || *library.Properties.Shared.Enabled)
731 func (library *libraryDecorator) getWholeStaticMissingDeps() []string {
732 return library.wholeStaticMissingDeps
735 func (library *libraryDecorator) objs() Objects {
736 return library.objects
739 func (library *libraryDecorator) reuseObjs() (Objects, []string, android.Paths) {
740 return library.reuseObjects, library.reuseExportedFlags, library.reuseExportedDeps
743 func (library *libraryDecorator) toc() android.OptionalPath {
744 return library.tocFile
747 func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) {
748 if library.shared() {
751 library.baseInstaller.subDir = "vndk-sp"
753 library.baseInstaller.subDir = "vndk"
760 library.baseInstaller.subDir += "-" + vndkVersion
764 library.baseInstaller.install(ctx, file)
767 if Bool(library.Properties.Static_ndk_lib) && library.static() &&
769 library.sanitize.isUnsanitizedVariant() {
780 library.ndkSysrootPath = installPath
784 func (library *libraryDecorator) static() bool {
785 return library.MutatedProperties.VariantIsStatic
788 func (library *libraryDecorator) shared() bool {
789 return library.MutatedProperties.VariantIsShared
792 func (library *libraryDecorator) header() bool {
793 return !library.static() && !library.shared()
796 func (library *libraryDecorator) setStatic() {
797 library.MutatedProperties.VariantIsStatic = true
798 library.MutatedProperties.VariantIsShared = false
801 func (library *libraryDecorator) setShared() {
802 library.MutatedProperties.VariantIsStatic = false
803 library.MutatedProperties.VariantIsShared = true
806 func (library *libraryDecorator) BuildOnlyStatic() {
807 library.MutatedProperties.BuildShared = false
810 func (library *libraryDecorator) BuildOnlyShared() {
811 library.MutatedProperties.BuildStatic = false
814 func (library *libraryDecorator) HeaderOnly() {
815 library.MutatedProperties.BuildShared = false
816 library.MutatedProperties.BuildStatic = false
822 library := &libraryDecorator{
834 module.compiler = library
835 module.linker = library
836 module.installer = library
838 return module, library
841 // connects a shared library to a static library in order to reuse its .o files to avoid
860 if library, ok := m.linker.(libraryInterface); ok {
862 if library.buildStatic() && library.buildShared() {
872 } else if library.buildStatic() {
875 } else if library.buildShared() {