assembly code produced from G++

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I look at the assembly code generated from this c++ file:

class MyClass { 
public : void signal_operation (fsm_events evt) {
// code of the function };
}

int main() {
MyClass c;
c.signal_operation(e1);
....
}

G++ change the name of the functions and the variables and this raise the 
assembly code size : signal_operation is changed to 
_ZN7MyClass16signal_operationE10fsm_events

file    "NSC.cpp"
    .section   
 .text._ZN7MyClass16signal_operationE10fsm_events,"axG",@progbits,_ZN7MyClass16signal_operationE10fsm_events,comdat

    .align 2
    .weak    _ZN7MyClass16signal_operationE10fsm_events
    .type    _ZN7MyClass16signal_operationE10fsm_events, @function
_ZN7MyClass16signal_operationE10fsm_events:
.LFB0:
    movl    (%rdi), %eax
    cmpl    $1, %eax
.....
.globl    main
    .type    main, @function
main:
........
    movl    $0, 12(%rsp)
    call    _ZN7MyClass16signal_operationE10fsm_events
 ......

However, when I compile the same C++ code (produce the same GIMPLE form) using 
my own front end I get nearly the same assembly without this names change.

.file    "NSC.cpp"
    .text
    .type    signal_operation.26, @function
signal_operation.26:
.LFB0:
    movl    (%rdi), %eax
    cmpl    $1, %eax
.....
.globl    main
    .type    main, @function
main:
.....
movl    $0, 12(%rsp)
call    signal_operation.26
 ......

I have 2 questions:
- Did my front end generate a bad assembly ? Is the name change necesseray to 
execute the code ?
- My assembly file did not contain those 3 lines for the signal_operation 
function:

    .section   
 .text._ZN7MyClass16signal_operationE10fsm_events,"axG",@progbits,_ZN7MyClass16signal_operationE10fsm_events,comdat

    .align 2
    .weak    _ZN7MyClass16signal_operationE10fsm_events 

are they essentiel to produce the right .o or the right  .out ? 

thank you very much

Asma



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux