tapi-tbdv5(1)

πŸ“¦ version 1600.0.11.8, in nixos 26.05, nixpkgs unstable

✨ NAME ✨

okay so welcome to tapi-tbdv5(1), the TAPI TBD Version 5 Format Documentation β€” aka the manual for tbd, aka Text Based Dynamic Library Stub. Yes bestie, it’s giving β€œstub file but make it readable” and we’re obsessed. πŸ’–

🫢 DESCRIPTION 🫢

So TAPI both generates and operates over text based stub files (.tbd). These files are a textual, human readable representation of Mach-O dynamic libraries (dylib) holding properties needed to resolve static link time dependencies including the same exported symbols as the original dynamic library. Version 5 and onward are represented in JSON. Periodt. ✨

πŸ” REQUIRED KEYS πŸ”

These keys are not optional, bestie. They’re required. Put them in or the vibe check fails. πŸ’…

  • tapi_tbd_version β€” <int> β€” Specifies the TBD file version. The only supported version is 5. No cap.
  • main_library β€” <dict> β€” Specifies the linkage properties of the main dylib in the TBD.
  • target_info β€” <array> β€” Specifies the supported targets of the dylib per target slice.
  • target β€” <architecture-platform> β€” Specify the architecture and platform identifier supported by the dylib. Those identifiers are mapped to the platform number that is specified by the Mach-O format for the LC_BUILD_VERSION load command. It is also possible to encode the platform with the platform number directly (for example: x86_64-maccatalyst). The following platform identifiers are supported: macos, maccatalyst, ios, ios-simulator, tvos, tvos-simulator, watchos, watchos-simulator.
  • min_deployment β€” <version> β€” Specify the minimum deployment version to match the target for the dylib. This key is part of the LC_BUILD_VERSION load command.
  • install_names β€” <array> β€” Specifies the install name of the dylib per target slice. This key is part of the LC_ID_DYLIB load command in the Mach-O format. If targets section is omitted, the install name is the same for all targets recorded in target_info.

🌈 OPTIONAL KEYS 🌈

These are the extra little accessories β€” cute but important. πŸŽ€

  • flags β€” <array> β€” Specifies the flags of the dylib per target slice. If targets section is omitted, the flags are the same for all targets recorded in target_info. Valid flags are: flat_namespace and not_app_extension_safe. flat_namespace is deprecated, but there are still some old binaries around on macOS that depend on flat namespace linking. The default is two level namespace linking. not_app_extension_safe indicates that the library is not safe to be used in an Application Extension.
  • current_versions β€” <array> β€” Specifies the current version of the dylib per target slice. This key is part of the LC_ID_DYLIB load command in the Mach-O format. If targets section is omitted, the current version is the same for all targets recorded in target_info. The default value is 1.0 if not specified.
  • compatibility_versions β€” <array> β€” Specifies the compatibility version of the dylib per target slice. This key is part of the LC_ID_DYLIB load command in the Mach-O format. If targets section is omitted, the compatibility version is the same for all targets recorded in target_info. The default value is 1.0 if not specified.
  • swift_abi β€” <array> β€” Specifies the Swift ABI version the dylib was compiled with per target slice. The Swift ABI version is encoded in the Objective-C image section, which doesn't exist in stubbed dynamic library files. If targets section is omitted, the compatibility version is the same for all targets recorded in target_info. The default value is 0 if not specified.
  • parent_umbrellas β€” <array> β€” Specifies the parent umbrella of the dylib per target slice. This key is equivalent to the LC_SUB_FRAMEWORK load command in the Mach-O format. If targets section is omitted, the parent umbrella is the same for all targets recorded in target_info.
  • reexported_libraries β€” <array> β€” Specifies the list of re-exported libraries of the dylib per target slice. This key is equivalent to the LC_REEXPORT_DYLIB load command in the Mach-O format. If targets section is omitted, the list of re-exported libraries are the same for all targets recorded in target_info.
  • rpaths β€” <array> β€” Specifies the list of runpath search paths of the dylib per target slice. This key is equivalent to the LC_RPATH load command in the Mach-O format. If targets section is omitted, the list of runpath search paths are the same for all targets recorded in target_info.
  • exported_symbols β€” <array> β€” Specifies the regular export symbol sections. If targets section is omitted, the exports are the same for all targets recorded in target_info.
  • reexported_symbols β€” <array> β€” Specifies the export symbol sections, but these symbols are not defined by the library itself. Instead, these symbols come from a different library. If targets section is omitted, the re-exports are the same for all targets recorded in target_info.
  • undefined_symbols β€” <array> β€” Specifies the undefined symbol sections and are only used for flat address space libraries. If targets section is omitted, the undefineds are the same for all targets recorded in target_info.
  • text β€” <dict> β€” Specifies the symbols defined in __TEXT segment of the library.
  • data β€” <dict> β€” Specifies the symbols defined in __DATA segment of the library.
  • global β€” <array> β€” Specifies a list of exported, re-exported, or undefined symbol names.
  • weak β€” <array> β€” Specifies the names of weak defined symbols for exported symbol sections or weak referenced symbols for undefined symbol sections.
  • thread_local β€” <array> β€” Specifies the symbol name of thread local exports.
  • objc_class β€” <array> β€” Specifies the list of exported, re-exported, or undefined Objective-C class names.
  • objc_eh_type β€” <array> β€” Specifies the list of exported, re-exported or undefined Objective-C class exception type names.
  • objc_ivar β€” <array> β€” Specifies the list of exported, re-exported or undefined Objective-C instance variable names.
  • libraries β€” <dict> β€” Specifies the inlined tbd attributes for the main_library's reexported libraries.

πŸ“ Examples πŸ“

Here’s the whole look, bestie β€” copy it exactly if you’re following along:

        {
        "tapi_tbd_version": 5,
        "main_library": {
          "target_info": [
            {
              "target": "x86_64-macos",
              "min_deployment": "10.14"
            },
            {
              "target": "arm64-macos",
              "min_deployment": "10.14"
            },
            {
              "target": "arm64-maccatalyst",
              "min_deployment": "12.1"
            }
          ],
          "flags":[
            {
              "targets": ["x86_64-macos"],
              "attributes": ["flat_namespace"]
            }
          ],
          "install_names":[
            {
              "name":"/System/Library/Frameworks/Foundation.framework/Foundation"
            }
          ],
          "current_versions":[
            {
              "version": "1.2"
            }
          ],
          "compatibility_versions":[
            {
              "version": "1.1"
            }
          ],
          "rpaths": [
            {
              "targets": ["x86_64-macos"],
              "paths": ["@executable_path/.../Frameworks"]
            }
          ],
          "parent_umbrellas": [
            {
              "umbrella": "System"
            }
          ],
          "allowable_clients": [
            {
                "clients": [
                    "ClientA",
                    "ClientB"
                ]
            }
          ],
          "reexported_libraries": [
            {
                "names": [
                    "/u/l/l/libfoo.dylib",
                    "/u/l/l/libbar.dylib"
                ]
            }
          ],
          "exported_symbols": [
            {
              "targets": ["x86_64-macos", "arm64-macos"],
              "data": {
                "global": ["_global"],
                "objc_class": ["ClassA"],
                "weak": [],
                "thread_local": []
              },
              "text": {
                "global": ["_func"],
                    "weak": [],
                    "thread_local": []
              }
            },
            {
              "targets": ["x86_64-macos"],
               "data": {
                   "global": ["_globalVar"],
                   "objc_class": ["ClassData"],
                   "objc_eh_type": ["ClassA", "ClassB"],
                   "objc_ivar": [
                      "ClassA.ivar1", "ClassA.ivar2", "ClassC.ivar1"
                   ]
               },
               "text": {
                   "global": ["_funcFoo"]
               }
            }
          ],
          "reexported_symbols": [
            {
              "targets": ["x86_64-macos","arm64-macos"],
              "data": {
                  "global": ["_globalRe"],
                  "objc_class": ["ClassRexport"]
              },
              "text": {
                  "global": ["_funcA"]
              }
            }
          ],
          "undefined_symbols": [
            {
              "targets": ["x86_64-macos"],
               "data": {
                  "global": ["_globalBind"],
                    "weak": ["referenced_sym"]
               }
            }
          ]
         }
        }

πŸ‘€ SEE ALSO πŸ‘€

If you’re still hungry for more manual-page content, go read: tapi(1), tapi-tbdv4(1), ld(1), Mach-O(5). Slay. πŸ¦‹


xoxo, Darwin 🌈 2023-03-08 🌸 tapi-tbdv5(1)

πŸ“¦ where this page comes from