gprof does not work with libc_p libraries in ubuntu?
Nick Clifton
nickc@redhat.com
Tue Nov 14 12:14:00 GMT 2006
Hi Mark,
> I've tried some experiments with the latest Ubuntu and I can't seem to
> properly link in the gprof'd standard libraries. The standard gprof'd
> libraries aren't linked in when I do:
>
> gcc -g -pg -o testme testme.c
>
> Then when I try to link them in I get:
>
> gcc -g -pg -o testme testme.c -lc_p
>> testme
>> Floating point exception (core dumped)
I assume that if you compile without "-pg" that your application then
runs without generating a floating point exception ?
The most likely cause for this is the C library's profiling hook code.
If you run the pap inside GDB you should be able to track down where the
fault is occurring. Alternatively you have run across a compiler bug
and the compiler is generating bad code when the -pg switch is used. (in
which case this ought to be reported on the gcc list).
> Then when I try to remove standard libs, I get a link error (can't
> find _Unwind_resume):
>
> gcc -g -pg -o testme testme.c -nodefaultlibs -lc_p -lgcc
Not surprising really since you are preventing the gcc program from
adding the necessary standard libraries to the linker command line. Try
running the same command without "-nodefaultlibs" but with "-v" added
and then compare the linker command line that gcc generates with the one
you were using above.
Cheers
Nick
More information about the Binutils
mailing list