Why does GCC emit multiple calls to __gcov_init, via mulitple (two) entries in
the ctors table? For example "int foo () { return 0; }" compiled with "gcc -S
-fprofile-generate" produces the following assembly file, where the ".ctors"
section conrtains two entries.
.file "x.c"
.text
.globl foo
.type foo, @function
foo:
pushl %ebp
movl %esp, %ebp
movl .LPBX1, %eax
movl .LPBX1+4, %edx
addl $1, %eax
adcl $0, %edx
movl %eax, .LPBX1
movl %edx, .LPBX1+4
movl $0, %eax
popl %ebp
ret
.size foo, .-foo
.local .LPBX1
.comm .LPBX1,8,8
.section .rodata
.LC0:
.string "/home/velco/x.gcda"
.data
.align 4
.LC1:
.long 3
.long 970900823
.long 1
.align 32
.type .LPBX0, @object
.size .LPBX0, 52
.LPBX0:
.long 875573861
.long 0
.long -786236445
.long .LC0
.long 1
.long .LC1
.long 1
.long 1
.long .LPBX1
.long __gcov_merge_add
.zero 12
.text
.type _GLOBAL__I_0_foo, @function
_GLOBAL__I_0_foo:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
movl $.LPBX0, (%esp)
call __gcov_init
leave
ret
.size _GLOBAL__I_0_foo, .-_GLOBAL__I_0_foo
.section .ctors,"aw",@progbits
.align 4
.long _GLOBAL__I_0_foo
.align 4
.long _GLOBAL__I_0_foo
.ident "GCC: (GNU) 4.2.0 20060425 (experimental)"
.section .note.GNU-stack,"",@progbits