_dune2_
Messages postés
141
Date d'inscription
mercredi 19 juillet 2006
Statut
Membre
Dernière intervention
20 avril 2011
29 févr. 2008 à 15:10
Un petit exemple vaut mieux que 2h d'explications ...
En gros tu veux faire une appli qui transforme ça :
=================================================
#include
#include <string>
using std::string;
using std::cout;
using std::endl;
int main(int argc, char **argv) {
string s = "hello";
cout << s << endl;
return 0;
}
=================================================
en ça :
=================================================
.file "main.cpp"
.section .ctors,"aw",@progbits
.align 4
.long _GLOBAL__I_main
.text
.align 2
.type _Z41__static_initialization_and_destruction_0ii, @function
_Z41__static_initialization_and_destruction_0ii:
.LFB1436:
pushl %ebp
.LCFI0:
movl %esp, %ebp
.LCFI1:
subl $24, %esp
.LCFI2:
movl %eax, -4(%ebp)
movl %edx, -8(%ebp)
cmpl $1, -4(%ebp)
jne .L5
cmpl $65535, -8(%ebp)
jne .L5
movl $_ZSt8__ioinit, (%esp)
call _ZNSt8ios_base4InitC1Ev
movl $__dso_handle, 8(%esp)
movl $0, 4(%esp)
movl $__tcf_0, (%esp)
call __cxa_atexit
.L5:
leave
ret
.LFE1436:
.size _Z41__static_initialization_and_destruction_0ii, .-_Z41__static_initialization_and_destruction_0ii
.globl __gxx_personality_v0
.align 2
.type _GLOBAL__I_main, @function
_GLOBAL__I_main:
.LFB1438:
pushl %ebp
.LCFI3:
movl %esp, %ebp
.LCFI4:
subl $8, %esp
.LCFI5:
movl $65535, %edx
movl $1, %eax
call _Z41__static_initialization_and_destruction_0ii
leave
ret
.LFE1438:
.size _GLOBAL__I_main, .-_GLOBAL__I_main
.align 2
.type __tcf_0, @function
__tcf_0:
.LFB1437:
pushl %ebp
.LCFI6:
movl %esp, %ebp
.LCFI7:
subl $8, %esp
.LCFI8:
movl $_ZSt8__ioinit, (%esp)
call _ZNSt8ios_base4InitD1Ev
leave
ret
.LFE1437:
.size __tcf_0, .-__tcf_0
.section .rodata
.LC0:
.string "hello"
.globl _Unwind_Resume
.text
.align 2
.globl main
.type main, @function
main:
.LFB1401:
leal 4(%esp), %ecx
.LCFI9:
andl $-16, %esp
pushl -4(%ecx)
.LCFI10:
pushl %ebp
.LCFI11:
movl %esp, %ebp
.LCFI12:
pushl %ebx
.LCFI13:
pushl %ecx
.LCFI14:
subl $48, %esp
.LCFI15:
leal -9(%ebp), %eax
movl %eax, (%esp)
call _ZNSaIcEC1Ev
leal -9(%ebp), %eax
movl %eax, 8(%esp)
movl $.LC0, 4(%esp)
leal -16(%ebp), %eax
movl %eax, (%esp)
.LEHB0:
call _ZNSsC1EPKcRKSaIcE
.LEHE0:
leal -9(%ebp), %eax
movl %eax, (%esp)
call _ZNSaIcED1Ev
leal -16(%ebp), %eax
movl %eax, 4(%esp)
movl $_ZSt4cout, (%esp)
.LEHB1:
call _ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKSbIS4_S5_T1_E
.LEHE1:
movl %eax, -28(%ebp)
jmp .L11
.L16:
movl %eax, -36(%ebp)
.L12:
movl -36(%ebp), %ebx
leal -9(%ebp), %eax
movl %eax, (%esp)
call _ZNSaIcED1Ev
movl %ebx, -36(%ebp)
movl -36(%ebp), %eax
movl %eax, (%esp)
.LEHB2:
call _Unwind_Resume
.LEHE2:
.L11:
movl $_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_, 4(%esp)
movl -28(%ebp), %eax
movl %eax, (%esp)
.LEHB3:
call _ZNSolsEPFRSoS_E
.LEHE3:
movl $0, %ebx
leal -16(%ebp), %eax
movl %eax, (%esp)
.LEHB4:
call _ZNSsD1Ev
.LEHE4:
movl %ebx, -32(%ebp)
jmp .L10
.L15:
movl %eax, -36(%ebp)
.L13:
movl -36(%ebp), %ebx
leal -16(%ebp), %eax
movl %eax, (%esp)
call _ZNSsD1Ev
movl %ebx, -36(%ebp)
movl -36(%ebp), %eax
movl %eax, (%esp)
.LEHB5:
call _Unwind_Resume
.LEHE5:
.L10:
movl -32(%ebp), %eax
addl $48, %esp
popl %ecx
popl %ebx
popl %ebp
leal -4(%ecx), %esp
ret
.LFE1401:
.size main, .-main
.section .gcc_except_table,"a",@progbits
.LLSDA1401:
.byte 0xff
.byte 0xff
.byte 0x1
.uleb128 .LLSDACSE1401-.LLSDACSB1401
.LLSDACSB1401:
.uleb128 .LEHB0-.LFB1401
.uleb128 .LEHE0-.LEHB0
.uleb128 .L16-.LFB1401
.uleb128 0x0
.uleb128 .LEHB1-.LFB1401
.uleb128 .LEHE1-.LEHB1
.uleb128 .L15-.LFB1401
.uleb128 0x0
.uleb128 .LEHB2-.LFB1401
.uleb128 .LEHE2-.LEHB2
.uleb128 0x0
.uleb128 0x0
.uleb128 .LEHB3-.LFB1401
.uleb128 .LEHE3-.LEHB3
.uleb128 .L15-.LFB1401
.uleb128 0x0
.uleb128 .LEHB4-.LFB1401
.uleb128 .LEHE4-.LEHB4
.uleb128 0x0
.uleb128 0x0
.uleb128 .LEHB5-.LFB1401
.uleb128 .LEHE5-.LEHB5
.uleb128 0x0
.uleb128 0x0
.LLSDACSE1401:
.text
.local _ZSt8__ioinit
.comm _ZSt8__ioinit,1,1
.weakref _Z20__gthrw_pthread_oncePiPFvvE,pthread_once
.weakref _Z27__gthrw_pthread_getspecificj,pthread_getspecific
.weakref _Z27__gthrw_pthread_setspecificjPKv,pthread_setspecific
.weakref _Z22__gthrw_pthread_createPmPK14pthread_attr_tPFPvS3_ES3_,pthread_create
.weakref _Z22__gthrw_pthread_cancelm,pthread_cancel
.weakref _Z26__gthrw_pthread_mutex_lockP15pthread_mutex_t,pthread_mutex_lock
.weakref _Z29__gthrw_pthread_mutex_trylockP15pthread_mutex_t,pthread_mutex_trylock
.weakref _Z28__gthrw_pthread_mutex_unlockP15pthread_mutex_t,pthread_mutex_unlock
.weakref _Z26__gthrw_pthread_mutex_initP15pthread_mutex_tPK19pthread_mutexattr_t,pthread_mutex_init
.weakref _Z26__gthrw_pthread_key_createPjPFvPvE,pthread_key_create
.weakref _Z26__gthrw_pthread_key_deletej,pthread_key_delete
.weakref _Z30__gthrw_pthread_mutexattr_initP19pthread_mutexattr_t,pthread_mutexattr_init
.weakref _Z33__gthrw_pthread_mutexattr_settypeP19pthread_mutexattr_ti,pthread_mutexattr_settype
.weakref _Z33__gthrw_pthread_mutexattr_destroyP19pthread_mutexattr_t,pthread_mutexattr_destroy
.section .eh_frame,"a",@progbits
.Lframe1:
.long .LECIE1-.LSCIE1
.LSCIE1:
.long 0x0
.byte 0x1
.string "zPL"
.uleb128 0x1
.sleb128 -4
.byte 0x8
.uleb128 0x6
.byte 0x0
.long __gxx_personality_v0
.byte 0x0
.byte 0xc
.uleb128 0x4
.uleb128 0x4
.byte 0x88
.uleb128 0x1
.align 4
.LECIE1:
.LSFDE1:
.long .LEFDE1-.LASFDE1
.LASFDE1:
.long .LASFDE1-.Lframe1
.long .LFB1436
.long .LFE1436-.LFB1436
.uleb128 0x4
.long 0x0
.byte 0x4
.long .LCFI0-.LFB1436
.byte 0xe
.uleb128 0x8
.byte 0x85
.uleb128 0x2
.byte 0x4
.long .LCFI1-.LCFI0
.byte 0xd
.uleb128 0x5
.align 4
.LEFDE1:
.LSFDE3:
.long .LEFDE3-.LASFDE3
.LASFDE3:
.long .LASFDE3-.Lframe1
.long .LFB1438
.long .LFE1438-.LFB1438
.uleb128 0x4
.long 0x0
.byte 0x4
.long .LCFI3-.LFB1438
.byte 0xe
.uleb128 0x8
.byte 0x85
.uleb128 0x2
.byte 0x4
.long .LCFI4-.LCFI3
.byte 0xd
.uleb128 0x5
.align 4
.LEFDE3:
.LSFDE5:
.long .LEFDE5-.LASFDE5
.LASFDE5:
.long .LASFDE5-.Lframe1
.long .LFB1437
.long .LFE1437-.LFB1437
.uleb128 0x4
.long 0x0
.byte 0x4
.long .LCFI6-.LFB1437
.byte 0xe
.uleb128 0x8
.byte 0x85
.uleb128 0x2
.byte 0x4
.long .LCFI7-.LCFI6
.byte 0xd
.uleb128 0x5
.align 4
.LEFDE5:
.LSFDE7:
.long .LEFDE7-.LASFDE7
.LASFDE7:
.long .LASFDE7-.Lframe1
.long .LFB1401
.long .LFE1401-.LFB1401
.uleb128 0x4
.long .LLSDA1401
.byte 0x4
.long .LCFI9-.LFB1401
.byte 0xc
.uleb128 0x1
.uleb128 0x0
.byte 0x9
.uleb128 0x4
.uleb128 0x1
.byte 0x4
.long .LCFI10-.LCFI9
.byte 0xc
.uleb128 0x4
.uleb128 0x4
.byte 0x4
.long .LCFI11-.LCFI10
.byte 0xe
.uleb128 0x8
.byte 0x85
.uleb128 0x2
.byte 0x4
.long .LCFI12-.LCFI11
.byte 0xd
.uleb128 0x5
.byte 0x4
.long .LCFI14-.LCFI12
.byte 0x84
.uleb128 0x4
.byte 0x83
.uleb128 0x3
.align 4
.LEFDE7:
.ident "GCC: (GNU) 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)"
.section .note.GNU-stack,"",@progbits
=================================================
Mouai ... ben y-a du pain sur la planche hein !! :)
Gentoo... que du bonheur ...