Skip to content

Instantly share code, notes, and snippets.

@winocm
Created March 25, 2014 14:32
Show Gist options
  • Save winocm/9763067 to your computer and use it in GitHub Desktop.
Save winocm/9763067 to your computer and use it in GitHub Desktop.
cctools-845 patch for forcing ARM disassembly. (please someone integrate into cctools proper..?)
diff -uNr cctools-845/otool/arm_disasm.c cctools-845+winocm/otool/arm_disasm.c
--- cctools-845/otool/arm_disasm.c 1969-12-31 18:00:00.000000000 -0600
+++ cctools-845+winocm/otool/arm_disasm.c 2014-03-25 09:26:56.000000000 -0500
@@ -4979,6 +4979,10 @@
if (force_thumb || in_thumb)
is_thumb = TRUE;
+ /* If we're forcing ARM disassembly fully, do it so. */
+ if (Aflag)
+ is_thumb = FALSE;
+
info->display_endian = little ? BFD_ENDIAN_LITTLE : BFD_ENDIAN_BIG;
info->bytes_per_line = 4;
diff -uNr cctools-845/otool/main.c cctools-845+winocm/otool/main.c
--- cctools-845/otool/main.c 1969-12-31 18:00:00.000000000 -0600
+++ cctools-845+winocm/otool/main.c 2014-03-25 09:27:56.000000000 -0500
@@ -88,6 +88,7 @@
enum bool Xflag = FALSE; /* don't print leading address in disassembly */
enum bool Zflag = FALSE; /* don't use simplified ppc mnemonics in disassembly */
enum bool Bflag = FALSE; /* force Thumb disassembly (ARM objects only) */
+enum bool Aflag = FALSE; /* force ARM disassembly (ARM objects only) */
enum bool Qflag = FALSE; /* use otool's disassembler */
enum bool qflag = FALSE; /* use 'C' Public llvm-mc disassembler */
enum bool jflag = FALSE; /* print opcode bytes */
@@ -477,6 +478,9 @@
case 'm':
use_member_syntax = FALSE;
break;
+ case 'A':
+ Aflag = TRUE;
+ break;
case 'B':
Bflag = TRUE;
break;
@@ -589,6 +593,7 @@
fprintf(stderr, "\t-X print no leading addresses or headers\n");
fprintf(stderr, "\t-m don't use archive(member) syntax\n");
fprintf(stderr, "\t-B force Thumb disassembly (ARM objects only)\n");
+ fprintf(stderr, "\t-A force ARM disassembly (ARM objects only)\n");
fprintf(stderr, "\t-q use llvm's disassembler (the default)\n");
fprintf(stderr, "\t-Q use otool(1)'s disassembler\n");
fprintf(stderr, "\t-mcpu=arg use `arg' as the cpu for disassembly\n");
diff -uNr cctools-845/otool/otool.h cctools-845+winocm/otool/otool.h
--- cctools-845/otool/otool.h 1969-12-31 18:00:00.000000000 -0600
+++ cctools-845+winocm/otool/otool.h 2014-03-25 09:26:24.000000000 -0500
@@ -57,6 +57,7 @@
extern enum bool Xflag; /* don't print leading address in disassembly */
extern enum bool Zflag; /* don't use simplified ppc mnemonics in disassembly */
extern enum bool Bflag; /* force Thumb disassembly (ARM objects only) */
+extern enum bool Aflag; /* force ARM disassembly (ARM objects only) */
extern enum bool Qflag; /* use the HACKED llvm-mc disassembler */
extern enum bool qflag; /* use 'C' Public llvm-mc disassembler */
extern enum bool gflag; /* group the disassembly */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment