On Sun, Apr 24, 2016 at 03:50:41PM +0200, Timo Buhrmester wrote:
 > Dump of assembler code for function mcount:
 >    0x0805045f <+0>:  push   %ebp
 >    0x08050460 <+1>:  push   %edi
 >    0x08050461 <+2>:  push   %esi
 >    0x08050462 <+3>:  push   %ebx
 >    0x08050463 <+4>:  sub    $0x18,%esp
 >    0x08050466 <+7>:  mov    %eax,%ebp
 >    0x08050468 <+9>:  mov    %ecx,0x8(%esp)
 >    0x0805046c <+13>: mov    %edx,%esi
 > => 0x0805046e <+15>: mov    0x4(%ebp),%ebx
 >    0x08050471 <+18>: mov    0x0(%ebp),%edi
 >    0x08050474 <+21>: mov    0x4(%edi),%edi
 >    0x08050477 <+24>: mov    0x80759e0,%ecx
 >    0x0805047d <+30>: test   %ecx,%ecx
 >    0x0805047f <+32>: je     0x805049f <mcount+64>
 >    0x08050481 <+34>: mov    0x8074880,%edx
 >    0x08050487 <+40>: test   %edx,%edx
 >    0x08050489 <+42>: je     0x805052f <mcount+208>

It appears that the mcount() entry point defined in
sys/arch/i386/include/profile.h is flatly broken with the new gcc --
the marked instruction is from an __asm that assumes a frame pointer
and there is no frame pointer.

Judging by what that code appears to be doing (e.g. saving caller-save
registers), writing it in C with __asm seems a mistake and bound to
explode with every new compiler version...

-- 
David A. Holland
dholl...@netbsd.org

Reply via email to