Commit 4ee37b1081f7320a55d57ec9c523f1b569f1e972
1 parent
3db881d6
trame de pile assembleur et modif atq
Showing
2 changed files
with
59 additions
and
3 deletions
Show diff stats
answerstoquestions
... | ... | @@ -15,7 +15,7 @@ après optimisation la taille est diminuée |
15 | 15 | |
16 | 16 | |
17 | 17 | |
18 | -Chaine de compilation 2/5 | |
18 | +////////////////////////////////////////////////////////////////////////////////////////// Chaine de compilation 2/5 ////////////////////////////////////////////////////////////////////////////////////////// | |
19 | 19 | |
20 | 20 | gcc : |
21 | 21 | |
... | ... | @@ -42,7 +42,8 @@ VarDecl 0x2c529d0 <col:1, col:5> col:5 used i 'int' |
42 | 42 | |
43 | 43 | |
44 | 44 | |
45 | - Chaine de compilation 3/5 ) | |
45 | +//////////////////////////////////////////////////////////////////////////////////////////// Chaine de compilation 3/5 ) //////////////////////////////////////////////////////////////////////////////////////////////////// | |
46 | + | |
46 | 47 | |
47 | 48 | dans quel segment mémoire se trouve la variable i ? Elle se trouve dans la pile (virtual-stack-vars) |
48 | 49 | |
... | ... | @@ -110,7 +111,7 @@ le printf est stocké dans une fonction à l'adresse 0xb7242f00 ? |
110 | 111 | |
111 | 112 | |
112 | 113 | |
113 | - | |
114 | +/////////////////////////////////////////////////////////////////////////////////////// | |
114 | 115 | |
115 | 116 | |
116 | 117 | ... | ... |
... | ... | @@ -0,0 +1,55 @@ |
1 | + .file "tramedepile.c" | |
2 | + .section .rodata | |
3 | +.LC0: | |
4 | + .string "a+b=%d\n" | |
5 | + .text | |
6 | + .globl addition | |
7 | + .type addition, @function | |
8 | +addition: | |
9 | +.LFB0: | |
10 | + .cfi_startproc | |
11 | + pushq %rbp | |
12 | + .cfi_def_cfa_offset 16 | |
13 | + .cfi_offset 6, -16 | |
14 | + movq %rsp, %rbp | |
15 | + .cfi_def_cfa_register 6 | |
16 | + subq $32, %rsp | |
17 | + movl %edi, -20(%rbp) | |
18 | + movl %esi, -24(%rbp) | |
19 | + movl -20(%rbp), %edx | |
20 | + movl -24(%rbp), %eax | |
21 | + addl %edx, %eax | |
22 | + movl %eax, -4(%rbp) | |
23 | + movl -4(%rbp), %eax | |
24 | + movl %eax, %esi | |
25 | + movl $.LC0, %edi | |
26 | + movl $0, %eax | |
27 | + call printf | |
28 | + leave | |
29 | + .cfi_def_cfa 7, 8 | |
30 | + ret | |
31 | + .cfi_endproc | |
32 | +.LFE0: | |
33 | + .size addition, .-addition | |
34 | + .globl main | |
35 | + .type main, @function | |
36 | +main: | |
37 | +.LFB1: | |
38 | + .cfi_startproc | |
39 | + pushq %rbp | |
40 | + .cfi_def_cfa_offset 16 | |
41 | + .cfi_offset 6, -16 | |
42 | + movq %rsp, %rbp | |
43 | + .cfi_def_cfa_register 6 | |
44 | + movl $1, %esi | |
45 | + movl $1, %edi | |
46 | + call addition | |
47 | + movl $0, %eax | |
48 | + popq %rbp | |
49 | + .cfi_def_cfa 7, 8 | |
50 | + ret | |
51 | + .cfi_endproc | |
52 | +.LFE1: | |
53 | + .size main, .-main | |
54 | + .ident "GCC: (Debian 4.9.2-10) 4.9.2" | |
55 | + .section .note.GNU-stack,"",@progbits | ... | ... |