Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Last active August 29, 2015 14:07
Show Gist options
  • Save shigemk2/e9b55a73332a2e0d2c05 to your computer and use it in GitHub Desktop.
Save shigemk2/e9b55a73332a2e0d2c05 to your computer and use it in GitHub Desktop.
char m[30000];
int main() {
int r = 0;
--m[r];
return 0;
}
! sh-elf-gcc -nostdlib -g -O a.c
! sh-elf-objdump -S a.out
a.out: ファイル形式 elf32-sh
セクション .text の逆アセンブル:
00001000 <_main>:
char m[30000];
int main() {
1000: 2f e6 mov.l r14,@-r15
1002: 6e f3 mov r15,r14
int r = 0;
--m[r];
1004: d2 03 mov.l 1014 <_main+0x14>,r2 ! 1098 <___ctors>
1006: 61 20 mov.b @r2,r1
1008: 71 ff add #-1,r1
100a: 22 10 mov.b r1,@r2
return 0;
}
100c: e0 00 mov #0,r0
100e: 6f e3 mov r14,r15
1010: 00 0b rts
1012: 6e f6 mov.l @r15+,r14
1014: 00 00 .word 0x0000
1016: 10 98 mov.l r9,@(32,r0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment