项目作者: AlexDenisov

项目描述 :
Retrieves Bitcode from Mach-O binaries
高级语言: C
项目地址: git://github.com/AlexDenisov/bitcode_retriever.git
创建时间: 2015-07-30T22:08:31Z
项目社区:https://github.com/AlexDenisov/bitcode_retriever

开源协议:MIT License

下载


Bitcode Retriever

Retrieves Bitcode from Mach-O binaries

About

Bitcode stores as an xar) archive inside of a Mach-O binary.

This tool extracts the archive and puts it near the binary, so it can be easily discovered using xar and llvm-dis

Build

Clone the repo and run make, built binary lays inside of build directory

  1. $ git clone git@github.com:AlexDenisov/bitcode_retriever.git
  2. $ cd bitcode_retriever
  3. $ make

Usage

Note: currently is does not work with static libraries, there is an opened issue #1, if you need this feature please a comment there, it will bump prioity of this project at my personal todo-list.

To use bitcode_retriever simple feed him your binary and it’ll produce archive with bitcode.

It accepts both fat and non-fat binaries. For fat binaries it produces separate archive for each slice, e.g.:

  1. $ bitcode_retriever fat_app
  2. i386.xar
  3. x86_64.xar
  4. arm64.xar

for non-fat binaries it produces just one archive with the bitcode:

  1. $ bitcode_retriever non_fat_app
  2. i386.xar

To skip the xar archive and obtain the bitcode immediately, pass the -e argument.

  1. $ bitcode_retriever -e fat_app
  2. i386.1.bc
  3. i386.2.bc
  4. x86_64.1.bc
  5. x86_64.2.bc

The project provides a sample binaries, you can play a bit with them:

  1. $ make subject
  2. $ cd build
  3. $ ./bitcode_retriever i386.o
  4. # or
  5. $ ./bitcode_retriever fat.o

The xar archive stores set of files with bitcode:

  1. $ xar -xf i386.o
  2. $ ls
  3. i386.o 1 2

You can dump LLVM IR from each file (1, 2) using llvm-dis

  1. $ llvm-dis 1
  2. $ llvm-dis 2
  3. $ ls
  4. 1 2 1.ll 2.ll

Bugs and issues

If you have any problems or found some bug - feel free to open an issue and/or send a pull request