Skip to content

Instantly share code, notes, and snippets.

@yoalex5
Last active August 6, 2019 19:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yoalex5/1bd16a4ddd7a457e4b189a443a45df93 to your computer and use it in GitHub Desktop.
Save yoalex5/1bd16a4ddd7a457e4b189a443a45df93 to your computer and use it in GitHub Desktop.
A reverse engineering Objective-C
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface GFICClassA : NSObject
//global constants
extern int const GFIC_GLOBAL_EXTERN_CONST_INT_1;
extern NSInteger const GFIC_GLOBAL_EXTERN_CONST_NSInteger_1;
extern NSString *const GFIC_GLOBAL_EXTERN_CONST_NSString_1;
//Public properties first
@property (nonatomic, strong) NSString *GFICGlobalPropertyNSString1;
//class methods
+ (NSString*)GFICclassMethod1:(NSString*)arg1 :(NSString*)arg2;
//instance methods
- (NSString*)GFICinstanceMethod1:(NSString*)arg1 :(NSString*)arg2;
- (void) GFICprintHelloWorld;
@end
NS_ASSUME_NONNULL_END
#import "GFICClassA.h"
// Declare global constants
int const GFIC_GLOBAL_EXTERN_CONST_INT_1 = 1;
NSInteger const GFIC_GLOBAL_EXTERN_CONST_NSInteger_1 = 1;
NSString *const GFIC_GLOBAL_EXTERN_CONST_NSString_1 = @"GFIC_GLOBAL_EXTERN_CONST_NSString_1_value";
// Declare local constants
static NSString *const GFIC_LOCAL_STATIC_CONS_1 = @"GFIC_LOCAL_STATIC_CONS_1_value";
@interface GFICClassA ()
@property (strong, nonatomic) NSString *GFICLocalPropertyNSString2;
@end
@implementation GFICClassA
//class methods
+ (NSString*)GFICclassMethod1:(NSString*)arg1 :(NSString*)arg2 {
printf("GFI classMethod1 called");
return @"GFI classMethod1_result";
}
//instance methods
- (NSString*)GFICinstanceMethod1:(NSString*)arg1 :(NSString*)arg2{
printf("GFI instanceMethod1 called");
self.GFICGlobalPropertyNSString1 = @"gfiGlobalPropertyNSString1_value";
self.GFICLocalPropertyNSString2 = @"gfiLocalPropertyNSString2_value";
return GFIC_GLOBAL_EXTERN_CONST_NSString_1;
}
- (void) GFICprintHelloWorld {
NSLog(@"Hello World! from ObjC");
}
@end
nm lists the symbols from object files objfile
-U Don't display undefined symbols.
nm -U libObjCUtils.a
libObjCUtils.a(GFICClassA.o):
0000000000000000 t +[GFICClassA GFICclassMethod1::]
0000000000000290 t -[GFICClassA .cxx_destruct]
00000000000001d0 t -[GFICClassA GFICGlobalPropertyNSString1]
0000000000000230 t -[GFICClassA GFICLocalPropertyNSString2]
00000000000000b0 t -[GFICClassA GFICinstanceMethod1::]
00000000000001a0 t -[GFICClassA GFICprintHelloWorld]
00000000000001f0 t -[GFICClassA setGFICGlobalPropertyNSString1:]
0000000000000250 t -[GFICClassA setGFICLocalPropertyNSString2:]
00000000000002e8 S _GFIC_GLOBAL_EXTERN_CONST_INT_1
00000000000002f0 S _GFIC_GLOBAL_EXTERN_CONST_NSInteger_1
0000000000000538 S _GFIC_GLOBAL_EXTERN_CONST_NSString_1
0000000000000540 s _GFIC_LOCAL_STATIC_CONS_1
00000000000008a8 S _OBJC_CLASS_$_GFICClassA
0000000000000658 S _OBJC_IVAR_$_GFICClassA._GFICGlobalPropertyNSString1
0000000000000660 S _OBJC_IVAR_$_GFICClassA._GFICLocalPropertyNSString2
0000000000000880 S _OBJC_METACLASS_$_GFICClassA
00000000000006b0 s l_OBJC_$_CLASS_METHODS_GFICClassA
0000000000000718 s l_OBJC_$_INSTANCE_METHODS_GFICClassA
00000000000007c8 s l_OBJC_$_INSTANCE_VARIABLES_GFICClassA
0000000000000810 s l_OBJC_$_PROP_LIST_GFICClassA
0000000000000838 s l_OBJC_CLASS_RO_$_GFICClassA
00000000000006d0 s l_OBJC_METACLASS_RO_$_GFICClassA
-g Display only global (external) symbols.
nm -g libObjCUtils.a
libObjCUtils.a(GFICClassA.o):
00000000000002e8 S _GFIC_GLOBAL_EXTERN_CONST_INT_1
00000000000002f0 S _GFIC_GLOBAL_EXTERN_CONST_NSInteger_1
0000000000000538 S _GFIC_GLOBAL_EXTERN_CONST_NSString_1
U _NSLog
00000000000008a8 S _OBJC_CLASS_$_GFICClassA
U _OBJC_CLASS_$_NSObject
0000000000000658 S _OBJC_IVAR_$_GFICClassA._GFICGlobalPropertyNSString1
0000000000000660 S _OBJC_IVAR_$_GFICClassA._GFICLocalPropertyNSString2
0000000000000880 S _OBJC_METACLASS_$_GFICClassA
U _OBJC_METACLASS_$_NSObject
U ___CFConstantStringClassReference
U __objc_empty_cache
U _objc_autoreleaseReturnValue
U _objc_msgSend
U _objc_retain
U _objc_storeStrong
U _printf
objdump -display information from object files.
-j -Display information only for section name.
-x -Display all available header information, including the symbol table and relocation entries. Using -x is equivalent to specifying all of -a -f -h -p -r -t.
objdump -x -j __objc_const -j __objc_classlist -j __text -j __objc_const libObjCUtils.a
libObjCUtils.a(GFICClassA.o): file format Mach-O 64-bit x86-64
RELOCATION RECORDS FOR [__text]:
00000000000002da X86_64_RELOC_BRANCH _objc_storeStrong
00000000000002cb X86_64_RELOC_SIGNED _OBJC_IVAR_$_GFICClassA._GFICGlobalPropertyNSString1
00000000000002c0 X86_64_RELOC_BRANCH _objc_storeStrong
00000000000002ab X86_64_RELOC_SIGNED _OBJC_IVAR_$_GFICClassA._GFICLocalPropertyNSString2
000000000000027d X86_64_RELOC_BRANCH _objc_storeStrong
000000000000026f X86_64_RELOC_SIGNED _OBJC_IVAR_$_GFICClassA._GFICLocalPropertyNSString2
0000000000000243 X86_64_RELOC_SIGNED _OBJC_IVAR_$_GFICClassA._GFICLocalPropertyNSString2
000000000000021d X86_64_RELOC_BRANCH _objc_storeStrong
000000000000020f X86_64_RELOC_SIGNED _OBJC_IVAR_$_GFICClassA._GFICGlobalPropertyNSString1
00000000000001e3 X86_64_RELOC_SIGNED _OBJC_IVAR_$_GFICClassA._GFICGlobalPropertyNSString1
00000000000001bd X86_64_RELOC_BRANCH _NSLog
00000000000001ab X86_64_RELOC_SIGNED __cfstring
0000000000000191 X86_64_RELOC_BRANCH _objc_autoreleaseReturnValue
0000000000000180 X86_64_RELOC_BRANCH _objc_storeStrong
0000000000000173 X86_64_RELOC_BRANCH _objc_storeStrong
0000000000000156 X86_64_RELOC_GOT_LOAD _objc_retain@GOTPCREL
000000000000014f X86_64_RELOC_SIGNED __cfstring
0000000000000142 X86_64_RELOC_SIGNED __cfstring
000000000000013b X86_64_RELOC_SIGNED __objc_selrefs
0000000000000127 X86_64_RELOC_GOT_LOAD _objc_msgSend@GOTPCREL
0000000000000120 X86_64_RELOC_SIGNED __cfstring
0000000000000119 X86_64_RELOC_SIGNED __objc_selrefs
000000000000010e X86_64_RELOC_BRANCH _printf
00000000000000fe X86_64_RELOC_SIGNED __cstring
00000000000000f7 X86_64_RELOC_BRANCH _objc_storeStrong
00000000000000db X86_64_RELOC_BRANCH _objc_storeStrong
00000000000000aa X86_64_RELOC_BRANCH _objc_autoreleaseReturnValue
0000000000000099 X86_64_RELOC_BRANCH _objc_storeStrong
000000000000008c X86_64_RELOC_BRANCH _objc_storeStrong
000000000000006c X86_64_RELOC_GOT_LOAD _objc_retain@GOTPCREL
0000000000000065 X86_64_RELOC_SIGNED __cfstring
000000000000005e X86_64_RELOC_BRANCH _printf
000000000000004e X86_64_RELOC_SIGNED __cstring
0000000000000047 X86_64_RELOC_BRANCH _objc_storeStrong
000000000000002b X86_64_RELOC_BRANCH _objc_storeStrong
RELOCATION RECORDS FOR [__objc_const]:
00000000000001c8 X86_64_RELOC_UNSIGNED l_OBJC_$_PROP_LIST_GFICClassA
00000000000001b8 X86_64_RELOC_UNSIGNED l_OBJC_$_INSTANCE_VARIABLES_GFICClassA
00000000000001a8 X86_64_RELOC_UNSIGNED l_OBJC_$_INSTANCE_METHODS_GFICClassA
00000000000001a0 X86_64_RELOC_UNSIGNED __objc_classname
0000000000000198 X86_64_RELOC_UNSIGNED __objc_classname
0000000000000180 X86_64_RELOC_UNSIGNED __cstring
0000000000000178 X86_64_RELOC_UNSIGNED __cstring
0000000000000170 X86_64_RELOC_UNSIGNED __cstring
0000000000000168 X86_64_RELOC_UNSIGNED __cstring
0000000000000150 X86_64_RELOC_UNSIGNED __objc_methtype
0000000000000148 X86_64_RELOC_UNSIGNED __objc_methname
0000000000000140 X86_64_RELOC_UNSIGNED _OBJC_IVAR_$_GFICClassA._GFICLocalPropertyNSString2
0000000000000130 X86_64_RELOC_UNSIGNED __objc_methtype
0000000000000128 X86_64_RELOC_UNSIGNED __objc_methname
0000000000000120 X86_64_RELOC_UNSIGNED _OBJC_IVAR_$_GFICClassA._GFICGlobalPropertyNSString1
0000000000000110 X86_64_RELOC_UNSIGNED -[GFICClassA setGFICLocalPropertyNSString2:]
0000000000000108 X86_64_RELOC_UNSIGNED __objc_methtype
0000000000000100 X86_64_RELOC_UNSIGNED __objc_methname
00000000000000f8 X86_64_RELOC_UNSIGNED -[GFICClassA GFICLocalPropertyNSString2]
00000000000000f0 X86_64_RELOC_UNSIGNED __objc_methtype
00000000000000e8 X86_64_RELOC_UNSIGNED __objc_methname
00000000000000e0 X86_64_RELOC_UNSIGNED -[GFICClassA setGFICGlobalPropertyNSString1:]
00000000000000d8 X86_64_RELOC_UNSIGNED __objc_methtype
00000000000000d0 X86_64_RELOC_UNSIGNED __objc_methname
00000000000000c8 X86_64_RELOC_UNSIGNED -[GFICClassA GFICGlobalPropertyNSString1]
00000000000000c0 X86_64_RELOC_UNSIGNED __objc_methtype
00000000000000b8 X86_64_RELOC_UNSIGNED __objc_methname
00000000000000b0 X86_64_RELOC_UNSIGNED -[GFICClassA .cxx_destruct]
00000000000000a8 X86_64_RELOC_UNSIGNED __objc_methtype
00000000000000a0 X86_64_RELOC_UNSIGNED __objc_methname
0000000000000098 X86_64_RELOC_UNSIGNED -[GFICClassA GFICprintHelloWorld]
0000000000000090 X86_64_RELOC_UNSIGNED __objc_methtype
0000000000000088 X86_64_RELOC_UNSIGNED __objc_methname
0000000000000080 X86_64_RELOC_UNSIGNED -[GFICClassA GFICinstanceMethod1::]
0000000000000078 X86_64_RELOC_UNSIGNED __objc_methtype
0000000000000070 X86_64_RELOC_UNSIGNED __objc_methname
0000000000000040 X86_64_RELOC_UNSIGNED l_OBJC_$_CLASS_METHODS_GFICClassA
0000000000000038 X86_64_RELOC_UNSIGNED __objc_classname
0000000000000018 X86_64_RELOC_UNSIGNED +[GFICClassA GFICclassMethod1::]
0000000000000010 X86_64_RELOC_UNSIGNED __objc_methtype
0000000000000008 X86_64_RELOC_UNSIGNED __objc_methname
RELOCATION RECORDS FOR [__objc_classlist]:
0000000000000000 X86_64_RELOC_UNSIGNED _OBJC_CLASS_$_GFICClassA
Sections:
Idx Name Size Address Type
0 __text 000002e4 0000000000000000 TEXT
10 __objc_const 000001d0 00000000000006b0 DATA
12 __objc_classlist 00000008 00000000000008d0 DATA
SYMBOL TABLE:
0000000000000000 l F __TEXT,__text +[GFICClassA GFICclassMethod1::]
00000000000000b0 l F __TEXT,__text -[GFICClassA GFICinstanceMethod1::]
00000000000001a0 l F __TEXT,__text -[GFICClassA GFICprintHelloWorld]
00000000000001d0 l F __TEXT,__text -[GFICClassA GFICGlobalPropertyNSString1]
00000000000001f0 l F __TEXT,__text -[GFICClassA setGFICGlobalPropertyNSString1:]
0000000000000230 l F __TEXT,__text -[GFICClassA GFICLocalPropertyNSString2]
0000000000000250 l F __TEXT,__text -[GFICClassA setGFICLocalPropertyNSString2:]
0000000000000290 l F __TEXT,__text -[GFICClassA .cxx_destruct]
0000000000000540 l __DATA,__const _GFIC_LOCAL_STATIC_CONS_1
00000000000006b0 l __DATA,__objc_const l_OBJC_$_CLASS_METHODS_GFICClassA
00000000000006d0 l __DATA,__objc_const l_OBJC_METACLASS_RO_$_GFICClassA
0000000000000718 l __DATA,__objc_const l_OBJC_$_INSTANCE_METHODS_GFICClassA
00000000000007c8 l __DATA,__objc_const l_OBJC_$_INSTANCE_VARIABLES_GFICClassA
0000000000000810 l __DATA,__objc_const l_OBJC_$_PROP_LIST_GFICClassA
0000000000000838 l __DATA,__objc_const l_OBJC_CLASS_RO_$_GFICClassA
00000000000002e8 g __TEXT,__const _GFIC_GLOBAL_EXTERN_CONST_INT_1
00000000000002f0 g __TEXT,__const _GFIC_GLOBAL_EXTERN_CONST_NSInteger_1
0000000000000538 g __DATA,__const _GFIC_GLOBAL_EXTERN_CONST_NSString_1
00000000000008a8 g __DATA,__objc_data _OBJC_CLASS_$_GFICClassA
0000000000000658 g __DATA,__objc_ivar _OBJC_IVAR_$_GFICClassA._GFICGlobalPropertyNSString1
0000000000000660 g __DATA,__objc_ivar _OBJC_IVAR_$_GFICClassA._GFICLocalPropertyNSString2
0000000000000880 g __DATA,__objc_data _OBJC_METACLASS_$_GFICClassA
0000000000000000 *UND* _NSLog
0000000000000000 *UND* _OBJC_CLASS_$_NSObject
0000000000000000 *UND* _OBJC_METACLASS_$_NSObject
0000000000000000 *UND* ___CFConstantStringClassReference
0000000000000000 *UND* __objc_empty_cache
0000000000000000 *UND* _objc_autoreleaseReturnValue
0000000000000000 *UND* _objc_msgSend
0000000000000000 *UND* _objc_retain
0000000000000000 *UND* _objc_storeStrong
0000000000000000 *UND* _printf
Mach header
magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
MH_MAGIC_64 X86_64 ALL 0x00 OBJECT 8 2352 SUBSECTIONS_VIA_SYMBOLS
Load command 4
cmd LC_LINKER_OPTION
cmdsize 40
count 2
string #1 -framework
string #2 Foundation
Load command 5
cmd LC_LINKER_OPTION
cmdsize 40
count 2
string #1 -framework
string #2 CFNetwork
Load command 6
cmd LC_LINKER_OPTION
cmdsize 32
count 2
string #1 -framework
string #2 Security
Load command 7
cmd LC_LINKER_OPTION
cmdsize 40
count 2
string #1 -framework
string #2 CoreFoundation
-d - display the assembler mnemonics for the machine instructions from objfile.
objdump -d libObjCUtils.a
libObjCUtils.a(GFICClassA.o): file format Mach-O 64-bit x86-64
Disassembly of section __TEXT,__text:
+[GFICClassA GFICclassMethod1::]:
0: 55 pushq %rbp
1: 48 89 e5 movq %rsp, %rbp
4: 48 83 ec 50 subq $80, %rsp
8: 48 89 7d f8 movq %rdi, -8(%rbp)
c: 48 89 75 f0 movq %rsi, -16(%rbp)
10: 48 c7 45 e8 00 00 00 00 movq $0, -24(%rbp)
18: 48 8d 75 e8 leaq -24(%rbp), %rsi
1c: 48 89 f7 movq %rsi, %rdi
1f: 48 89 75 d8 movq %rsi, -40(%rbp)
23: 48 89 d6 movq %rdx, %rsi
26: 48 89 4d d0 movq %rcx, -48(%rbp)
2a: e8 00 00 00 00 callq 0 <+[GFICClassA GFICclassMethod1::]+0x2f>
2f: 48 c7 45 e0 00 00 00 00 movq $0, -32(%rbp)
37: 48 8d 4d e0 leaq -32(%rbp), %rcx
3b: 48 89 cf movq %rcx, %rdi
3e: 48 8b 75 d0 movq -48(%rbp), %rsi
42: 48 89 4d c8 movq %rcx, -56(%rbp)
46: e8 00 00 00 00 callq 0 <+[GFICClassA GFICclassMethod1::]+0x4b>
4b: 48 8d 3d ef 02 00 00 leaq 751(%rip), %rdi
52: 31 c0 xorl %eax, %eax
54: 41 88 c0 movb %al, %r8b
57: 89 45 c4 movl %eax, -60(%rbp)
5a: 44 88 c0 movb %r8b, %al
5d: e8 00 00 00 00 callq 0 <+[GFICClassA GFICclassMethod1::]+0x62>
62: 48 8d 3d 4f 04 00 00 leaq 1103(%rip), %rdi
69: 48 8b 0d 00 00 00 00 movq (%rip), %rcx
70: 89 45 c0 movl %eax, -64(%rbp)
73: ff d1 callq *%rcx
75: 44 8b 4d c4 movl -60(%rbp), %r9d
79: 44 89 c9 movl %r9d, %ecx
7c: 48 8b 7d c8 movq -56(%rbp), %rdi
80: 48 89 ce movq %rcx, %rsi
83: 48 89 45 b8 movq %rax, -72(%rbp)
87: 48 89 4d b0 movq %rcx, -80(%rbp)
8b: e8 00 00 00 00 callq 0 <+[GFICClassA GFICclassMethod1::]+0x90>
90: 48 8b 7d d8 movq -40(%rbp), %rdi
94: 48 8b 75 b0 movq -80(%rbp), %rsi
98: e8 00 00 00 00 callq 0 <+[GFICClassA GFICclassMethod1::]+0x9d>
9d: 48 8b 45 b8 movq -72(%rbp), %rax
a1: 48 89 c7 movq %rax, %rdi
a4: 48 83 c4 50 addq $80, %rsp
a8: 5d popq %rbp
a9: e9 00 00 00 00 jmp 0 <+[GFICClassA GFICclassMethod1::]+0xae>
ae: 66 90 nop
-[GFICClassA GFICinstanceMethod1::]:
b0: 55 pushq %rbp
b1: 48 89 e5 movq %rsp, %rbp
b4: 48 83 ec 60 subq $96, %rsp
b8: 48 89 7d f8 movq %rdi, -8(%rbp)
bc: 48 89 75 f0 movq %rsi, -16(%rbp)
c0: 48 c7 45 e8 00 00 00 00 movq $0, -24(%rbp)
c8: 48 8d 75 e8 leaq -24(%rbp), %rsi
cc: 48 89 f7 movq %rsi, %rdi
cf: 48 89 75 d8 movq %rsi, -40(%rbp)
d3: 48 89 d6 movq %rdx, %rsi
d6: 48 89 4d d0 movq %rcx, -48(%rbp)
da: e8 00 00 00 00 callq 0 <-[GFICClassA GFICinstanceMethod1::]+0x2f>
df: 48 c7 45 e0 00 00 00 00 movq $0, -32(%rbp)
e7: 48 8d 4d e0 leaq -32(%rbp), %rcx
eb: 48 89 cf movq %rcx, %rdi
ee: 48 8b 75 d0 movq -48(%rbp), %rsi
f2: 48 89 4d c8 movq %rcx, -56(%rbp)
f6: e8 00 00 00 00 callq 0 <-[GFICClassA GFICinstanceMethod1::]+0x4b>
fb: 48 8d 3d 6f 02 00 00 leaq 623(%rip), %rdi
102: 31 c0 xorl %eax, %eax
104: 41 88 c0 movb %al, %r8b
107: 89 45 c4 movl %eax, -60(%rbp)
10a: 44 88 c0 movb %r8b, %al
10d: e8 00 00 00 00 callq 0 <-[GFICClassA GFICinstanceMethod1::]+0x62>
112: 48 8b 7d f8 movq -8(%rbp), %rdi
116: 48 8b 35 2b 05 00 00 movq 1323(%rip), %rsi
11d: 48 8d 15 b4 03 00 00 leaq 948(%rip), %rdx
124: 48 8b 0d 00 00 00 00 movq (%rip), %rcx
12b: 89 45 c0 movl %eax, -64(%rbp)
12e: 48 89 4d b8 movq %rcx, -72(%rbp)
132: ff d1 callq *%rcx
134: 48 8b 7d f8 movq -8(%rbp), %rdi
138: 48 8b 35 11 05 00 00 movq 1297(%rip), %rsi
13f: 48 8d 15 b2 03 00 00 leaq 946(%rip), %rdx
146: 48 8b 4d b8 movq -72(%rbp), %rcx
14a: ff d1 callq *%rcx
14c: 48 8d 3d 25 03 00 00 leaq 805(%rip), %rdi
153: 48 8b 0d 00 00 00 00 movq (%rip), %rcx
15a: ff d1 callq *%rcx
15c: 44 8b 4d c4 movl -60(%rbp), %r9d
160: 44 89 c9 movl %r9d, %ecx
163: 48 8b 7d c8 movq -56(%rbp), %rdi
167: 48 89 ce movq %rcx, %rsi
16a: 48 89 45 b0 movq %rax, -80(%rbp)
16e: 48 89 4d a8 movq %rcx, -88(%rbp)
172: e8 00 00 00 00 callq 0 <-[GFICClassA GFICinstanceMethod1::]+0xc7>
177: 48 8b 7d d8 movq -40(%rbp), %rdi
17b: 48 8b 75 a8 movq -88(%rbp), %rsi
17f: e8 00 00 00 00 callq 0 <-[GFICClassA GFICinstanceMethod1::]+0xd4>
184: 48 8b 45 b0 movq -80(%rbp), %rax
188: 48 89 c7 movq %rax, %rdi
18b: 48 83 c4 60 addq $96, %rsp
18f: 5d popq %rbp
190: e9 00 00 00 00 jmp 0 <-[GFICClassA GFICinstanceMethod1::]+0xe5>
195: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:(%rax,%rax)
19f: 90 nop
-[GFICClassA GFICprintHelloWorld]:
1a0: 55 pushq %rbp
1a1: 48 89 e5 movq %rsp, %rbp
1a4: 48 83 ec 10 subq $16, %rsp
1a8: 48 8d 05 69 03 00 00 leaq 873(%rip), %rax
1af: 48 89 7d f8 movq %rdi, -8(%rbp)
1b3: 48 89 75 f0 movq %rsi, -16(%rbp)
1b7: 48 89 c7 movq %rax, %rdi
1ba: b0 00 movb $0, %al
1bc: e8 00 00 00 00 callq 0 <-[GFICClassA GFICprintHelloWorld]+0x21>
1c1: 48 83 c4 10 addq $16, %rsp
1c5: 5d popq %rbp
1c6: c3 retq
1c7: 66 0f 1f 84 00 00 00 00 00 nopw (%rax,%rax)
-[GFICClassA GFICGlobalPropertyNSString1]:
1d0: 55 pushq %rbp
1d1: 48 89 e5 movq %rsp, %rbp
1d4: 48 89 7d f8 movq %rdi, -8(%rbp)
1d8: 48 89 75 f0 movq %rsi, -16(%rbp)
1dc: 48 8b 75 f8 movq -8(%rbp), %rsi
1e0: 48 8b 3d 00 00 00 00 movq (%rip), %rdi
1e7: 48 8b 04 3e movq (%rsi,%rdi), %rax
1eb: 5d popq %rbp
1ec: c3 retq
1ed: 0f 1f 00 nopl (%rax)
-[GFICClassA setGFICGlobalPropertyNSString1:]:
1f0: 55 pushq %rbp
1f1: 48 89 e5 movq %rsp, %rbp
1f4: 48 83 ec 20 subq $32, %rsp
1f8: 48 89 7d f8 movq %rdi, -8(%rbp)
1fc: 48 89 75 f0 movq %rsi, -16(%rbp)
200: 48 89 55 e8 movq %rdx, -24(%rbp)
204: 48 8b 55 e8 movq -24(%rbp), %rdx
208: 48 8b 75 f8 movq -8(%rbp), %rsi
20c: 48 8b 3d 00 00 00 00 movq (%rip), %rdi
213: 48 01 fe addq %rdi, %rsi
216: 48 89 f7 movq %rsi, %rdi
219: 48 89 d6 movq %rdx, %rsi
21c: e8 00 00 00 00 callq 0 <-[GFICClassA setGFICGlobalPropertyNSString1:]+0x31>
221: 48 83 c4 20 addq $32, %rsp
225: 5d popq %rbp
226: c3 retq
227: 66 0f 1f 84 00 00 00 00 00 nopw (%rax,%rax)
-[GFICClassA GFICLocalPropertyNSString2]:
230: 55 pushq %rbp
231: 48 89 e5 movq %rsp, %rbp
234: 48 89 7d f8 movq %rdi, -8(%rbp)
238: 48 89 75 f0 movq %rsi, -16(%rbp)
23c: 48 8b 75 f8 movq -8(%rbp), %rsi
240: 48 8b 3d 00 00 00 00 movq (%rip), %rdi
247: 48 8b 04 3e movq (%rsi,%rdi), %rax
24b: 5d popq %rbp
24c: c3 retq
24d: 0f 1f 00 nopl (%rax)
-[GFICClassA setGFICLocalPropertyNSString2:]:
250: 55 pushq %rbp
251: 48 89 e5 movq %rsp, %rbp
254: 48 83 ec 20 subq $32, %rsp
258: 48 89 7d f8 movq %rdi, -8(%rbp)
25c: 48 89 75 f0 movq %rsi, -16(%rbp)
260: 48 89 55 e8 movq %rdx, -24(%rbp)
264: 48 8b 55 e8 movq -24(%rbp), %rdx
268: 48 8b 75 f8 movq -8(%rbp), %rsi
26c: 48 8b 3d 00 00 00 00 movq (%rip), %rdi
273: 48 01 fe addq %rdi, %rsi
276: 48 89 f7 movq %rsi, %rdi
279: 48 89 d6 movq %rdx, %rsi
27c: e8 00 00 00 00 callq 0 <-[GFICClassA setGFICLocalPropertyNSString2:]+0x31>
281: 48 83 c4 20 addq $32, %rsp
285: 5d popq %rbp
286: c3 retq
287: 66 0f 1f 84 00 00 00 00 00 nopw (%rax,%rax)
-[GFICClassA .cxx_destruct]:
290: 55 pushq %rbp
291: 48 89 e5 movq %rsp, %rbp
294: 48 83 ec 20 subq $32, %rsp
298: 31 c0 xorl %eax, %eax
29a: 89 c1 movl %eax, %ecx
29c: 48 89 7d f8 movq %rdi, -8(%rbp)
2a0: 48 89 75 f0 movq %rsi, -16(%rbp)
2a4: 48 8b 75 f8 movq -8(%rbp), %rsi
2a8: 48 8b 3d 00 00 00 00 movq (%rip), %rdi
2af: 48 89 f2 movq %rsi, %rdx
2b2: 48 01 fa addq %rdi, %rdx
2b5: 48 89 d7 movq %rdx, %rdi
2b8: 48 89 75 e8 movq %rsi, -24(%rbp)
2bc: 48 89 ce movq %rcx, %rsi
2bf: e8 00 00 00 00 callq 0 <-[GFICClassA .cxx_destruct]+0x34>
2c4: 31 c0 xorl %eax, %eax
2c6: 89 c6 movl %eax, %esi
2c8: 48 8b 0d 00 00 00 00 movq (%rip), %rcx
2cf: 48 8b 55 e8 movq -24(%rbp), %rdx
2d3: 48 01 ca addq %rcx, %rdx
2d6: 48 89 d7 movq %rdx, %rdi
2d9: e8 00 00 00 00 callq 0 <-[GFICClassA .cxx_destruct]+0x4e>
2de: 48 83 c4 20 addq $32, %rsp
2e2: 5d popq %rbp
2e3: c3 retq
-s - Display the full contents of any sections requested.
objdump -s -j __objc_classname -j __objc_methname -j __cstring libObjCUtils.a
libObjCUtils.a(GFICClassA.o): file format Mach-O 64-bit x86-64
Contents of section __cstring:
02f8 47464943 5f474c4f 42414c5f 45585445 GFIC_GLOBAL_EXTE
0308 524e5f43 4f4e5354 5f4e5353 7472696e RN_CONST_NSStrin
0318 675f315f 76616c75 65004746 49435f4c g_1_value.GFIC_L
0328 4f43414c 5f535441 5449435f 434f4e53 OCAL_STATIC_CONS
0338 5f315f76 616c7565 00474649 20636c61 _1_value.GFI cla
0348 73734d65 74686f64 31206361 6c6c6564 ssMethod1 called
0358 00474649 20636c61 73734d65 74686f64 .GFI classMethod
0368 315f7265 73756c74 00474649 20696e73 1_result.GFI ins
0378 74616e63 654d6574 686f6431 2063616c tanceMethod1 cal
0388 6c656400 67666947 6c6f6261 6c50726f led.gfiGlobalPro
0398 70657274 794e5353 7472696e 67315f76 pertyNSString1_v
03a8 616c7565 00676669 4c6f6361 6c50726f alue.gfiLocalPro
03b8 70657274 794e5353 7472696e 67325f76 pertyNSString2_v
03c8 616c7565 0048656c 6c6f2057 6f726c64 alue.Hello World
03d8 21206672 6f6d204f 626a4300 47464943 ! from ObjC.GFIC
03e8 4c6f6361 6c50726f 70657274 794e5353 LocalPropertyNSS
03f8 7472696e 67320054 40224e53 53747269 tring2.T@"NSStri
0408 6e67222c 262c4e2c 565f4746 49434c6f ng",&,N,V_GFICLo
0418 63616c50 726f7065 7274794e 53537472 calPropertyNSStr
0428 696e6732 00474649 43476c6f 62616c50 ing2.GFICGlobalP
0438 726f7065 7274794e 53537472 696e6731 ropertyNSString1
0448 00544022 4e535374 72696e67 222c262c .T@"NSString",&,
0458 4e2c565f 47464943 476c6f62 616c5072 N,V_GFICGlobalPr
0468 6f706572 74794e53 53747269 6e673100 opertyNSString1.
Contents of section __objc_methname:
0548 73657447 46494347 6c6f6261 6c50726f setGFICGlobalPro
0558 70657274 794e5353 7472696e 67313a00 pertyNSString1:.
0568 73657447 4649434c 6f63616c 50726f70 setGFICLocalProp
0578 65727479 4e535374 72696e67 323a0047 ertyNSString2:.G
0588 46494363 6c617373 4d657468 6f64313a FICclassMethod1:
0598 3a004746 4943696e 7374616e 63654d65 :.GFICinstanceMe
05a8 74686f64 313a3a00 47464943 7072696e thod1::.GFICprin
05b8 7448656c 6c6f576f 726c6400 2e637878 tHelloWorld..cxx
05c8 5f646573 74727563 74004746 4943476c _destruct.GFICGl
05d8 6f62616c 50726f70 65727479 4e535374 obalPropertyNSSt
05e8 72696e67 31004746 49434c6f 63616c50 ring1.GFICLocalP
05f8 726f7065 7274794e 53537472 696e6732 ropertyNSString2
0608 005f4746 4943476c 6f62616c 50726f70 ._GFICGlobalProp
0618 65727479 4e535374 72696e67 31005f47 ertyNSString1._G
0628 4649434c 6f63616c 50726f70 65727479 FICLocalProperty
0638 4e535374 72696e67 3200 NSString2.
Contents of section __objc_classname:
0668 47464943 436c6173 73410002 00 GFICClassA...
view the content of Mach-O executables
-L -Display the names and version numbers of the shared libraries that the object file uses
otool -L libObjCUtils.a
Archive : libObjCUtils.a
libObjCUtils.a(GFICClassA.o):
This will get you all the strings. A string is any sequence of 4 (the default) or more printing characters [ending at, but not including, any other character or EOF].
strings libObjCUtils.a
strings "libObjCUtils.a(GFICClassA.o)"
GFIC_GLOBAL_EXTERN_CONST_NSString_1_value
GFIC_LOCAL_STATIC_CONS_1_value
GFI classMethod1 called
GFI classMethod1_result
GFI instanceMethod1 called
gfiGlobalPropertyNSString1_value
gfiLocalPropertyNSString2_value
Hello World! from ObjC
GFICLocalPropertyNSString2
T@"NSString",&,N,V_GFICLocalPropertyNSString2
GFICGlobalPropertyNSString1
T@"NSString",&,N,V_GFICGlobalPropertyNSString1
setGFICGlobalPropertyNSString1:
setGFICLocalPropertyNSString2:
GFICclassMethod1::
GFICinstanceMethod1::
GFICprintHelloWorld
.cxx_destruct
GFICGlobalPropertyNSString1
GFICLocalPropertyNSString2
_GFICGlobalPropertyNSString1
_GFICLocalPropertyNSString2
GFICClassA
GFIC_GLOBAL_EXTERN_CONST_INT_1
GFIC_GLOBAL_EXTERN_CONST_NSInteger_1
GFIC_GLOBAL_EXTERN_CONST_NSString_1
GFIC_LOCAL_STATIC_CONS_1
GFICClassA
GFICLocalPropertyNSString2
GFICGlobalPropertyNSString1
_GFICGlobalPropertyNSString1
_GFICLocalPropertyNSString2
ObjCUtils
+[GFICClassA GFICclassMethod1::]
GFICclassMethod1::
-[GFICClassA GFICinstanceMethod1::]
GFICinstanceMethod1::
-[GFICClassA GFICprintHelloWorld]
GFICprintHelloWorld
-[GFICClassA GFICGlobalPropertyNSString1]
-[GFICClassA setGFICGlobalPropertyNSString1:]
setGFICGlobalPropertyNSString1:
-[GFICClassA GFICLocalPropertyNSString2]
-[GFICClassA setGFICLocalPropertyNSString2:]
setGFICLocalPropertyNSString2:
-[GFICClassA .cxx_destruct]
GFICClassA.m
GFICClassA.h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment