Chrizzldi
Chrizzldi

Reputation: 561

Mac OS X, how to compile a .c file for ARM and disassemble it after?

I want to disassemble a simple .c file:

#define UPPER 15 
const int lower = 12;
int sum = 0;

int main(void) { 
  int i;
  for(i = lower; i < UPPER; i++) 
  { 
    sum += i;
  }
return sum;
}

To get the assemblercode for ARM CPUs on my Mac Mini 10.8.3. There fore i am stuck at:

Thanks for your Help!

Upvotes: 1

Views: 1580

Answers (1)

bsa2000
bsa2000

Reputation: 382

To compile (assuming the target is iOS 6.0):

xcrun -sdk iphoneos c++ -arch armv7 -marm -march=armv7-a -miphoneos-version-min=6.0 -g -O3 <any other options ...>

To disassemble:

otool -tdv <your binary>

Upvotes: 1

Related Questions