main.c:
/* main.c */
#include <stdio.h>
int world(int *a, int *b, int *c, int *d,int *e,int *f,int *a1, int *b1, int *c1, int *d1,int *e1,int *f1){
int sum=*a+*b+*c+*d+*e+*f+*a1+*b1+*c1+*d1+*e1+*f1;
return sum;
}
int hello(int *a, int *b, int *c, int *d,int *e,int *f,int *a1, int *b1, int *c1, int *d1,int *e1,int *f1){
int sum = world(a,b,c,d,e,f,a1,b1,c1,d1,e1,f1);
return sum++;
}
int main(void){
int a,b,c,d,e,f,a1,b1,c1,d1,e1,f1;
a=1;
b=2;
c=3;
d=4;
e=5;
f=6;
a1=11;
b1=12;
c1=13;
d1=14;
e1=15;
f1=16;
hello(&a,&b,&c,&d,&e,&f,&a1,&b1,&c1,&d1,&e1,&f1);
return 0;
}
arm-none-linux-gnueabi-gcc -g main.c
arm-none-linux-gnueabi-objdump -S -d a.out > a.s
a.out: file format elf32-littlearm
Disassembly of section .init:
0000830c <_init>:
830c: e92d4010 push {r4, lr}
8310: eb00001d bl 838c <call_gmon_start>
8314: e8bd4010 pop {r4, lr}
8318: e12fff1e bx lr
Disassembly of section .plt:
0000831c <.plt>:
831c: e52de004 push {lr} ; (str lr, [sp, #-4]!)
8320: e59fe004 ldr lr, [pc, #4] ; 832c <_init+0x20>
8324: e08fe00e add lr, pc, lr
8328: e5bef008 ldr pc, [lr, #8]!
832c: 00008514 .word 0x00008514
8330: e28fc600 add ip, pc, #0 ; 0x0
8334: e28cca08 add ip, ip, #32768 ; 0x8000
8338: e5bcf514 ldr pc, [ip, #1300]!
833c: e28fc600 add ip, pc, #0 ; 0x0
8340: e28cca08 add ip, ip, #32768 ; 0x8000
8344: e5bcf50c ldr pc, [ip, #1292]!
8348: e28fc600 add ip, pc, #0 ; 0x0
834c: e28cca08 add ip, ip, #32768 ; 0x8000
8350: e5bcf504 ldr pc, [ip, #1284]!
Disassembly of section .text:
00008354 <_start>:
8354: e59fc024 ldr ip, [pc, #36] ; 8380 <_start+0x2c>
8358: e3a0b000 mov fp, #0 ; 0x0
835c: e49d1004 pop {r1} ; (ldr r1, [sp], #4)
8360: e1a0200d mov r2, sp
8364: e52d2004 push {r2} ; (str r2, [sp, #-4]!)
8368: e52d0004 push {r0} ; (str r0, [sp, #-4]!)
836c: e59f0010 ldr r0, [pc, #16] ; 8384 <_start+0x30>
8370: e59f3010 ldr r3, [pc, #16] ; 8388 <_start+0x34>
8374: e52dc004 push {ip} ; (str ip, [sp, #-4]!)
8378: ebffffef bl 833c <_init+0x30>
837c: ebffffeb bl 8330 <_init+0x24>
8380: 00008638 .word 0x00008638
8384: 0000855c .word 0x0000855c
8388: 0000863c .word 0x0000863c
0000838c <call_gmon_start>:
838c: e59f301c ldr r3, [pc, #28] ; 83b0 <call_gmon_start+0x24>
8390: e59f201c ldr r2, [pc, #28] ; 83b4 <call_gmon_start+0x28>
8394: e08f3003 add r3, pc, r3
8398: e7931002 ldr r1, [r3, r2]
839c: e3510000 cmp r1, #0 ; 0x0
83a0: e92d4010 push {r4, lr}
83a4: 1bffffe7 blne 8348 <_init+0x3c>
83a8: e8bd4010 pop {r4, lr}
83ac: e12fff1e bx lr
83b0: 000084a4 .word 0x000084a4
83b4: 00000018 .word 0x00000018
000083b8 <__do_global_dtors_aux>:
83b8: e59f2010 ldr r2, [pc, #16] ; 83d0 <__do_global_dtors_aux+0x18>
83bc: e5d23000 ldrb r3, [r2]
83c0: e3530000 cmp r3, #0 ; 0x0
83c4: 03a03001 moveq r3, #1 ; 0x1
83c8: 05c23000 strbeq r3, [r2]
83cc: e12fff1e bx lr
83d0: 00010864 .word 0x00010864
000083d4 <frame_dummy>:
83d4: e59f0020 ldr r0, [pc, #32] ; 83fc <frame_dummy+0x28>
83d8: e92d4010 push {r4, lr}
83dc: e5903000 ldr r3, [r0]
83e0: e3530000 cmp r3, #0 ; 0x0
83e4: 08bd8010 popeq {r4, pc}
83e8: e59f3010 ldr r3, [pc, #16] ; 8400 <frame_dummy+0x2c>
83ec: e3530000 cmp r3, #0 ; 0x0
83f0: 08bd8010 popeq {r4, pc}
83f4: e12fff33 blx r3
83f8: e8bd8010 pop {r4, pc}
83fc: 0001074c .word 0x0001074c
8400: 00000000 .word 0x00000000
00008404 <world>:
/* main.c */
#include <stdio.h>
int world(int *a, int *b, int *c, int *d,int *e,int *f,int *a1, int *b1, int *c1, int *d1,int *e1,int *f1){
8404: e52db004 push {fp} ; (str fp, [sp, #-4]!)
8408: e28db000 add fp, sp, #0 ; 0x0
840c: e24dd01c sub sp, sp, #28 ; 0x1c
8410: e50b0010 str r0, [fp, #-16]
8414: e50b1014 str r1, [fp, #-20]
8418: e50b2018 str r2, [fp, #-24]
841c: e50b301c str r3, [fp, #-28]
int sum=*a+*b+*c+*d+*e+*f+*a1+*b1+*c1+*d1+*e1+*f1;
8420: e51b3010 ldr r3, [fp, #-16]
8424: e5932000 ldr r2, [r3]
8428: e51b3014 ldr r3, [fp, #-20]
842c: e5933000 ldr r3, [r3]
8430: e0822003 add r2, r2, r3
8434: e51b3018 ldr r3, [fp, #-24]
8438: e5933000 ldr r3, [r3]
843c: e0822003 add r2, r2, r3
8440: e51b301c ldr r3, [fp, #-28]
8444: e5933000 ldr r3, [r3]
8448: e0822003 add r2, r2, r3
844c: e59b3004 ldr r3, [fp, #4]
8450: e5933000 ldr r3, [r3]
8454: e0822003 add r2, r2, r3
8458: e59b3008 ldr r3, [fp, #8]
845c: e5933000 ldr r3, [r3]
8460: e0822003 add r2, r2, r3
8464: e59b300c ldr r3, [fp, #12]
8468: e5933000 ldr r3, [r3]
846c: e0822003 add r2, r2, r3
8470: e59b3010 ldr r3, [fp, #16]
8474: e5933000 ldr r3, [r3]
8478: e0822003 add r2, r2, r3
847c: e59b3014 ldr r3, [fp, #20]
8480: e5933000 ldr r3, [r3]
8484: e0822003 add r2, r2, r3
8488: e59b3018 ldr r3, [fp, #24]
848c: e5933000 ldr r3, [r3]
8490: e0822003 add r2, r2, r3
8494: e59b301c ldr r3, [fp, #28]
8498: e5933000 ldr r3, [r3]
849c: e0822003 add r2, r2, r3
84a0: e59b3020 ldr r3, [fp, #32]
84a4: e5933000 ldr r3, [r3]
84a8: e0823003 add r3, r2, r3
84ac: e50b3008 str r3, [fp, #-8]
return sum;
84b0: e51b3008 ldr r3, [fp, #-8]
}
84b4: e1a00003 mov r0, r3
84b8: e28bd000 add sp, fp, #0 ; 0x0
84bc: e8bd0800 pop {fp}
84c0: e12fff1e bx lr
000084c4 <hello>:
int hello(int *a, int *b, int *c, int *d,int *e,int *f,int *a1, int *b1, int *c1, int *d1,int *e1,int *f1){
84c4: e92d4800 push {fp, lr}
84c8: e28db004 add fp, sp, #4 ; 0x4
84cc: e24dd038 sub sp, sp, #56 ; 0x38
84d0: e50b0010 str r0, [fp, #-16]
84d4: e50b1014 str r1, [fp, #-20]
84d8: e50b2018 str r2, [fp, #-24]
84dc: e50b301c str r3, [fp, #-28]
int sum = world(a,b,c,d,e,f,a1,b1,c1,d1,e1,f1);
84e0: e59b3004 ldr r3, [fp, #4]
84e4: e58d3000 str r3, [sp]
84e8: e59b3008 ldr r3, [fp, #8]
84ec: e58d3004 str r3, [sp, #4]
84f0: e59b300c ldr r3, [fp, #12]
84f4: e58d3008 str r3, [sp, #8]
84f8: e59b3010 ldr r3, [fp, #16]
84fc: e58d300c str r3, [sp, #12]
8500: e59b3014 ldr r3, [fp, #20]
8504: e58d3010 str r3, [sp, #16]
8508: e59b3018 ldr r3, [fp, #24]
850c: e58d3014 str r3, [sp, #20]
8510: e59b301c ldr r3, [fp, #28]
8514: e58d3018 str r3, [sp, #24]
8518: e59b3020 ldr r3, [fp, #32]
851c: e58d301c str r3, [sp, #28]
8520: e51b0010 ldr r0, [fp, #-16]
8524: e51b1014 ldr r1, [fp, #-20]
8528: e51b2018 ldr r2, [fp, #-24]
852c: e51b301c ldr r3, [fp, #-28]
8530: ebffffb3 bl 8404 <world>
8534: e1a03000 mov r3, r0
8538: e50b3008 str r3, [fp, #-8]
return sum++;
853c: e51b2008 ldr r2, [fp, #-8]
8540: e51b3008 ldr r3, [fp, #-8]
8544: e2833001 add r3, r3, #1 ; 0x1
8548: e50b3008 str r3, [fp, #-8]
854c: e1a03002 mov r3, r2
}
8550: e1a00003 mov r0, r3
8554: e24bd004 sub sp, fp, #4 ; 0x4
8558: e8bd8800 pop {fp, pc}
0000855c <main>:
int main(void){
855c: e92d4800 push {fp, lr}
8560: e28db004 add fp, sp, #4 ; 0x4
8564: e24dd050 sub sp, sp, #80 ; 0x50
int a,b,c,d,e,f,a1,b1,c1,d1,e1,f1;
a=1;
8568: e3a03001 mov r3, #1 ; 0x1
856c: e50b3008 str r3, [fp, #-8]
b=2;
8570: e3a03002 mov r3, #2 ; 0x2
8574: e50b300c str r3, [fp, #-12]
c=3;
8578: e3a03003 mov r3, #3 ; 0x3
857c: e50b3010 str r3, [fp, #-16]
d=4;
8580: e3a03004 mov r3, #4 ; 0x4
8584: e50b3014 str r3, [fp, #-20]
e=5;
8588: e3a03005 mov r3, #5 ; 0x5
858c: e50b3018 str r3, [fp, #-24]
f=6;
8590: e3a03006 mov r3, #6 ; 0x6
8594: e50b301c str r3, [fp, #-28]
a1=11;
8598: e3a0300b mov r3, #11 ; 0xb
859c: e50b3020 str r3, [fp, #-32]
b1=12;
85a0: e3a0300c mov r3, #12 ; 0xc
85a4: e50b3024 str r3, [fp, #-36]
c1=13;
85a8: e3a0300d mov r3, #13 ; 0xd
85ac: e50b3028 str r3, [fp, #-40]
d1=14;
85b0: e3a0300e mov r3, #14 ; 0xe
85b4: e50b302c str r3, [fp, #-44]
e1=15;
85b8: e3a0300f mov r3, #15 ; 0xf
85bc: e50b3030 str r3, [fp, #-48]
f1=16;
85c0: e3a03010 mov r3, #16 ; 0x10
85c4: e50b3034 str r3, [fp, #-52]
hello(&a,&b,&c,&d,&e,&f,&a1,&b1,&c1,&d1,&e1,&f1);
85c8: e24b2008 sub r2, fp, #8 ; 0x8
85cc: e24b100c sub r1, fp, #12 ; 0xc
85d0: e24bc010 sub ip, fp, #16 ; 0x10
85d4: e24be014 sub lr, fp, #20 ; 0x14
85d8: e24b3018 sub r3, fp, #24 ; 0x18
85dc: e58d3000 str r3, [sp]
85e0: e24b301c sub r3, fp, #28 ; 0x1c
85e4: e58d3004 str r3, [sp, #4]
85e8: e24b3020 sub r3, fp, #32 ; 0x20
85ec: e58d3008 str r3, [sp, #8]
85f0: e24b3024 sub r3, fp, #36 ; 0x24
85f4: e58d300c str r3, [sp, #12]
85f8: e24b3028 sub r3, fp, #40 ; 0x28
85fc: e58d3010 str r3, [sp, #16]
8600: e24b302c sub r3, fp, #44 ; 0x2c
8604: e58d3014 str r3, [sp, #20]
8608: e24b3030 sub r3, fp, #48 ; 0x30
860c: e58d3018 str r3, [sp, #24]
8610: e24b3034 sub r3, fp, #52 ; 0x34
8614: e58d301c str r3, [sp, #28]
8618: e1a00002 mov r0, r2
861c: e1a0200c mov r2, ip
8620: e1a0300e mov r3, lr
8624: ebffffa6 bl 84c4 <hello>
return 0;
8628: e3a03000 mov r3, #0 ; 0x0
}
862c: e1a00003 mov r0, r3
8630: e24bd004 sub sp, fp, #4 ; 0x4
8634: e8bd8800 pop {fp, pc}
00008638 <__libc_csu_fini>:
8638: e12fff1e bx lr
0000863c <__libc_csu_init>:
863c: e92d47f0 push {r4, r5, r6, r7, r8, r9, sl, lr}
8640: e1a08001 mov r8, r1
8644: e1a07002 mov r7, r2
8648: e1a0a000 mov sl, r0
864c: ebffff2e bl 830c <_init>
8650: e59f104c ldr r1, [pc, #76] ; 86a4 <__libc_csu_init+0x68>
8654: e59f304c ldr r3, [pc, #76] ; 86a8 <__libc_csu_init+0x6c>
8658: e59f204c ldr r2, [pc, #76] ; 86ac <__libc_csu_init+0x70>
865c: e0613003 rsb r3, r1, r3
8660: e08f2002 add r2, pc, r2
8664: e1b05143 asrs r5, r3, #2
8668: e0822001 add r2, r2, r1
866c: 0a00000a beq 869c <__libc_csu_init+0x60>
8670: e1a06002 mov r6, r2
8674: e3a04000 mov r4, #0 ; 0x0
8678: e1a0000a mov r0, sl
867c: e1a01008 mov r1, r8
8680: e1a02007 mov r2, r7
8684: e796c104 ldr ip, [r6, r4, lsl #2]
8688: e1a0e00f mov lr, pc
868c: e12fff1c bx ip
8690: e2844001 add r4, r4, #1 ; 0x1
8694: e1540005 cmp r4, r5
8698: 3afffff6 bcc 8678 <__libc_csu_init+0x3c>
869c: e8bd47f0 pop {r4, r5, r6, r7, r8, r9, sl, lr}
86a0: e12fff1e bx lr
86a4: ffffff04 .word 0xffffff04
86a8: ffffff08 .word 0xffffff08
86ac: 000081d8 .word 0x000081d8
Disassembly of section .fini:
000086b0 <_fini>:
86b0: e92d4010 push {r4, lr}
86b4: e8bd4010 pop {r4, lr}
86b8: e12fff1e bx lr