[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problems when linking against the profiled libc
- To: Shlomi Fish <shlomif(at-nospam)techst02.technion.ac.il>
- Subject: Re: Problems when linking against the profiled libc
- From: "Nadav Har'El" <nyh(at-nospam)math.technion.ac.il>
- Date: Sun, 2 Dec 2001 12:45:07 +0200
- Cc: linux-il(at-nospam)linux.org.il
- Delivered-To: linux.org.il-linux-il@linux.org.il
- Hebrew-Date: 17 Kislev 5762
- In-Reply-To: <Pine.GSO.4.33.0112021224390.9690-100000@techst02.technion.ac.il>; from shlomif@techst02.technion.ac.il on Sun, Dec 02, 2001 at 12:32:30PM +0200
- References: <Pine.GSO.4.33.0112021224390.9690-100000@techst02.technion.ac.il>
- Sender: linux-il-bounce(at-nospam)cs.huji.ac.il
- User-Agent: Mutt/1.2i
On Sun, Dec 02, 2001, Shlomi Fish wrote about "Problems when linking against the profiled libc":
>
> When invoking the following command:
>
> gcc -Wall -o mptest -L. test_multi_parallel.o -lfcs -lm -pg -lc_p
>
> I get the following error:
>
> gcc -Wall -o mptest -L. test_multi_parallel.o -lfcs -lm -pg -lc_p
> /usr/bin/ld-real: /lib/ld-linux.so.2: indirect symbol
>...
I saw an error similar to this on my Redhat 7.2. Apparently the
glibc-profile-2.2.4-19 only contains a non-shared library (/usr/lib/libc_p.a)
and for some reason -lc_p works, but incorrectly, when ld is looking for
shared libraries (I never bothered to look for why this error is happening -
you might want to report it to Redhat's bugzilla).
Anyway, adding "-static" to the linking line fixed the problem (it also
generated a huge static executable, but that shouldn't be a problem for an
executable that was only meant for profiling).
> I checked that the problem persists with the command:
> gcc test.c -pg -lc_p
By the way, when profiling, you should also use "-g". Without debugging
information, some of the information gprof gives you (namely, in which file
each routine lives) will be wrong - and this is especially annoying when
you're profiling something with "static" functions (where a function by the
same name can come from several files).
--
Nadav Har'El | Sunday, Dec 2 2001, 17 Kislev 5762
nyh@math.technion.ac.il |-----------------------------------------
Phone: +972-53-245868, ICQ 13349191 |A Nobel Peace Prize? I would KILL for one
http://nadav.harel.org.il |of those.
=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il