Im really beginner of assembly language, and trying to compile the C code and reverse it with otool into assembly language.
int main() {
printf("a");
return 0;
}
Then, after gcc -o main main.c; otool -tvV main
main:
(__TEXT,__text) section
_main:
0000000100000f60 pushq %rbp
0000000100000f61 movq %rsp, %rbp
0000000100000f64 subq $0x10, %rsp
0000000100000f68 movl $0x0, -0x4(%rbp)
0000000100000f6f leaq 0x34(%rip), %rdi ## literal pool for: "a"
0000000100000f76 movb $0x0, %al
0000000100000f78 callq 0x100000f8a ## symbol stub for: _printf
0000000100000f7d xorl %ecx, %ecx
0000000100000f7f movl %eax, -0x8(%rbp)
0000000100000f82 movl %ecx, %eax
0000000100000f84 addq $0x10, %rsp
0000000100000f88 popq %rbp
0000000100000f89 retq
if i change this print(a)
to print another string:
main:
(__TEXT,__text) section
_main:
0000000100000f50 pushq %rbp
0000000100000f51 movq %rsp, %rbp
0000000100000f54 subq $0x10, %rsp
0000000100000f58 movl $0x0, -0x4(%rbp)
0000000100000f5f leaq 0x34(%rip), %rdi ## literal pool for: "iiidachsaljhdlasjdlsajdsajkha"
0000000100000f66 movb $0x0, %al
0000000100000f68 callq 0x100000f7a ## symbol stub for: _printf
0000000100000f6d xorl %ecx, %ecx
0000000100000f6f movl %eax, -0x8(%rbp)
0000000100000f72 movl %ecx, %eax
0000000100000f74 addq $0x10, %rsp
0000000100000f78 popq %rbp
0000000100000f79 retq
then i can see the comment (##) says it is trying to print another string literals, but as long as i read assembly language, cannot tell how it defines specific literals (no difference found between the former and the latter assembly (reverse result).
Could anyone teach me how it works? assembly language hides the definition of string literals???