On Sun, Dec 02, 2001, Oleg Goldshmidt wrote about "Re: Problems when linking against the profiled libc": > Shlomi Fish <[EMAIL PROTECTED]> writes: > > > When invoking the following command: > > > > gcc -Wall -o mptest -L. test_multi_parallel.o -lfcs -lm -pg -lc_p > > I don't think you should use -lc_p explicitly. Using -pg in the link > command should link the right library
No, I think Shlomi is right. In Linux, at least, -pg when linking *doesn't* take profiling versions of the C libraries. Whether this is justified or not, it is arguable (AT&T Unix did do what you describe). In Linux (at least Red Hat Linux) you don't even have to install the profiling libraries, which come in the glibc-profile package (which takes over 35 megabytes on your hard disk, so non-developers shouldn't even install it). You also have libm_p, and other similar libraries compiled with profiling on. I just tested this on a "hello world", and indeed what I just said seems to be true: without the explicit -lc_p (but with -pg) none of the libc functions (like printf) got counted, and only main() got counted. With the explicit -lc_p (and -pg), many libc functions like printf(), write(), exit(), etc., got counted in that program. > > to `__libc_internal_tsd_set@@GLIBC_2.0' is a loop > > What version of glibc are you using? You would probably do well > upgrading from 2.0. I am not sure that this is what causes your > problem, but... The same problem happens in Redhat 7.2's glibc 2.2.4-19. > It works for me (checked on RH7.1, Linux 2.4.9-12): I don't think this problem existed on Redhat 7.1. It does on Redhat 7.2, though. It's probably a bug in the linker... > $ cat > hello.c > #include <stdio.h> > int main(void) > { > printf("Hello, world!\n"); > return 0; > } > $ gcc -pg hello.c -lc Hey, you didn't use -lc_p - no wonder you didn't have compilation problems ;) > Profiling works just fine, and I don't use -static explicitly. And you didn't use -lc_p, and you probably didn't see any other function besides main() in the profiling results... -- Nadav Har'El | Sunday, Dec 2 2001, 17 Kislev 5762 [EMAIL PROTECTED] |----------------------------------------- Phone: +972-53-245868, ICQ 13349191 |The human mind is like a parachute - it http://nadav.harel.org.il |functions better when it is open. ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]