Peng Zhao wrote:
> And is there any neat solution to avoid
> "undefined reference to `__profile_pu_init'" error when using
> special libraries? Following are the tries I made: Can somebody explain
> me the related environment varialbes?
>
> -------------------
>
> NUE>sgicc -fb_create ./test test.c -o test
> test.o:/usr/sakwatamau/brule12/grad/pengzhao/test/test.c:4: undefined
> reference to `__profile_init' test.o: In function `main':
> test.o(.text+0x72): undefined reference to `__profile_pu_init'
> test.o(.text+0x92): undefined reference to `__profile_invoke_init'
> test.o(.text+0xb2): undefined reference to `__profile_branch_init'
> test.o(.text+0xd2): undefined reference to `__profile_call_init'
> test.o(.text+0xf2): undefined reference to `__profile_invoke'
> test.o(.text+0x162): undefined reference to `__profile_branch'
> test.o(.text+0x1b2): undefined reference to `__profile_call_entry'
> test.o(.text+0x212): undefined reference to `__profile_call_exit'
> test.o(.text+0x252): undefined reference to `__profile_call_entry'
> test.o(.text+0x2b2): undefined reference to `__profile_call_exit'
> collect2: ld returned 1 exit status NUE:/usr/brule12/grad/pengzhao/test>
> -----------------------
> NUE>sgicc -fb_create ./test test.c -o test -linstr
> /usr/lib/gcc-lib/ia64-hp-linux/2.9-ia64-000216/../../../../ia64-hp-linux/bin/ld:
> cannot find -linstr collect2: ld returned 1 exit status
> ------------------------
__profile_init and the other undefined names are the names of procedures
in the libiinstr.so library used during instrumentation. During
compilation with instrumentation, calls to these procedures are inserted
into the WHIRL code of the program being compiled. When the instrumented
binary is run, these procedure perform the frequency counts and generate
the file of feedback data.
The flag "-linstr" in the second example tells the linker to include the
libinstr.so library, but the linker is unable to find it. I suggest to
first make sure that you have build the libinstr.so library. Second,
compile using the flags "-linstr -L<path>", where <path> is the location
of the libinstr.so library.
- David
--
David Stephenson http://reality.sgi.com/dlstephe_engr/
|