GithubHelp home page GithubHelp logo

tbdump's Introduction

TBDump

Note: Still lots of TODO's. Consider this a beta.

What is this?

A developer tool to dump .tbd files off Mach-O dylibs and frameworks.

Why would I need this?

TL;DR: ld64 for iOS can no longer link against dylibs and Apple stopped shipping .tbd's for private APIs.

Because starting with XCode 7, the linker for iOS on arm64 will no longer accept Mach-O shared libraries to link against, but only .tbd files.
Additionally, starting with XCode 7.3, PrivateFrameworks .tbd files are no longer shipped with the iOS SDK1.

So you will only need this if all of the following hold true:

  • You develop for iOS
  • You target arm64
  • You link against anything other than the iOS SDK public API

You won't need it for anything else... for now (all SDKs already ship .tbd's instead of dylibs, so this might change some time).
You should still be able to use it for any other platform though, and it will certainly reduce the SDK size.

1 They were also removed from the tvOS and watchOS SDKs, but watchOS is 32-bit-only anyway and for tvOS, ld64 seems to still be able to link against dylibs. So linking against PrivateFrameworks on those platforms is as easy as extracting the libraries form the dyld shared cache of an unzipped OTA bundle.

How do I build it?

To build for your current platform:

make

To build a fat Mach-O for armv7, arm64 and x86_64:

make fat

How do I use it?

Like this:

tbdump mylib.dylib > mylib.tbd

For help, run with no arguments (note: -r still unimplemented):

Usage:
    tbdump [-f] dylib
    tbdump -r [-f] folder

Description:
    Create text-based stub libraries (.tbd files) from dylibs or frameworks.
    In default mode, output is written to stdout.
    Use "-" to read from stdin.

Options:
    -f  Force parsing of all files and ignore all I/O and format errors.
    -r  "Recursive mode": Recurse into a directory, parsing all files whose
        names end in ".dylib" or which have no suffix at all.
        Rather than writing to stdout, rebuild the source directory tree in the
        current directory, with .tbd files replacing dylibs and frameworks.

Return values:
    0   Success
    1   Generic error
    2   Invalid argument
    3   Memory error
    4   File I/O error
    5   Data format error

TODO

  • Implement recursive mode
  • Support inlining re-exports
  • Linux support
  • Tokens:
    • allowed-clients
    • re-exports
    • thread-local-symbols
    • swift-version
    • objc-constraint
  • Test the hell out of this
  • Maybe even Windows support

tbdump's People

Contributors

siguza avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.