I patched a 2.4.9 kernel with the profiling package,
and the kernel crashes right away when I try to
enable some other mode than PC sampling.
Seems like the combination of regparm, -pg flag and
-O2 flag are causing trouble.
I tried Redhat's gcc 2.96, as well as their gcc 3.0.4,
and I'm seeing this behavior with both of the
If I compile kernel with '-O2', call to
mcount is done as the very first thing with functions
which are declared with 'asmlinkage'.
c0142c20: e8 2b c7 0c 00 call c020f350
c0142c25: 55 push %ebp
c0142c26: 89 e5 mov %esp,%ebp
c0142c28: 57 push %edi
c0142c29: 56 push %esi
c0142c2a: 53 push %ebx
c0142c2b: 56 push %esi
But if I drop the optimization level to -O, call to
mcount is done after contents of esp have been
moved to ebp.
c0140fd0: 55 push %ebp
c0140fd1: 89 e5 mov %esp,%ebp
c0140fd3: 57 push %edi
c0140fd4: 56 push %esi
c0140fd5: 53 push %ebx
c0140fd6: 83 ec 04 sub $0x4,%esp
c0140fd9: e8 42 43 0c 00 call c0205320
c0140fde: 8b 7d 0c mov 0xc(%ebp),%edi
c0140fe1: 8b 5d 10 mov 0x10(%ebp),%ebx
I assume this is a gcc bug, but I'm a bit suprised
that I haven't seen anybody else report this.
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free