Unix Technical Forum

How does one link for profiling on Hpux 11.0 ?

This is a discussion on How does one link for profiling on Hpux 11.0 ? within the HP-UX Operating System forums, part of the Unix Operating Systems category; --> If a 'cc' to compile and link is run with the -p option, the link fails with the symbols ...


Go Back   Unix Technical Forum > Unix Operating Systems > HP-UX Operating System

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-17-2008, 06:50 AM
KosayaFarrago@aol.com
 
Posts: n/a
Default How does one link for profiling on Hpux 11.0 ?

If a 'cc' to compile and link is run with the -p option, the link fails with
the symbols shl_load and shl_unload undefined.

It does not help to force archive linking with the -Wl,-a,archive argument.
This does link all .a libraries but some of them reference the shared library
routines as well. (Seems strange???)

Forcing the dynamic loader to link using -ldld does resolve the undefined
symbols but then networking routines such as 'gethostbyname()' and
'inet_addr()' will fail.


Any help will be appreciated.


Thank you,

Kosaya
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-17-2008, 06:50 AM
Rick Jones
 
Posts: n/a
Default Re: How does one link for profiling on Hpux 11.0 ?

KosayaFarrago@aol.com wrote:
> If a 'cc' to compile and link is run with the -p option, the link
> fails with the symbols shl_load and shl_unload undefined.


> It does not help to force archive linking with the -Wl,-a,archive
> argument. This does link all .a libraries but some of them
> reference the shared library routines as well. (Seems strange???)


> Forcing the dynamic loader to link using -ldld does resolve the
> undefined symbols but then networking routines such as
> 'gethostbyname()' and 'inet_addr()' will fail.


What are your _full_ compile and link commands?

> Any help will be appreciated.


Well, if it weren't for being on 11.0, I'd suggest just a "normal"
build and http://www.hp.com/go/prospect to do your profiling.

rick jones
--
portable adj, code that compiles under more than one compiler
these opinions are mine, all mine; HP might not want them anyway...
feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-17-2008, 06:50 AM
Rick Jones
 
Posts: n/a
Default Re: How does one link for profiling on Hpux 11.0 ?

Rick Jones <rick.jones2@hp.com> wrote:
> Well, if it weren't for being on 11.0, I'd suggest just a "normal"
> build and http://www.hp.com/go/prospect to do your profiling.


Actually, I went back to poke around a bit - there is a chance that
11.0 is/was supported for Prospect, so it may be worthwhile
registering and grabbing a copy.

rick jones
--
The computing industry isn't as much a game of "Follow The Leader" as
it is one of "Ring Around the Rosy" or perhaps "Duck Duck Goose."
- Rick Jones
these opinions are mine, all mine; HP might not want them anyway...
feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-17-2008, 06:50 AM
Dennis Handly
 
Posts: n/a
Default Re: How does one link for profiling on Hpux 11.0 ?

KosayaFarrago@aol.com wrote:
> If a 'cc' to compile and link is run with the -p option, the link fails
> with the symbols shl_load and shl_unload undefined.
>
> It does not help to force archive linking with the -Wl,-a,archive
> argument. This does link all .a libraries but some of them reference the
> shared library routines as well. (Seems strange???)
>
> Forcing the dynamic loader to link using -ldld does resolve the
> undefined symbols but then networking routines such as 'gethostbyname()'
> and 'inet_addr()' will fail.


(Why would you ever want to use -p instead of -G?)

The short answer is you can't use -p/-G if you need to have those
networking functions or setlocale that use shl_load.

Using -p/-G links in an archive version of libc, /usr/lib/libp/libc.a.
The last time someone asked about this, there were two types of sockets
being used and that wasn't possible.

When you say "will fail" above, what did you mean?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-17-2008, 06:50 AM
KosayaFarrago@aol.com
 
Posts: n/a
Default Re: How does one link for profiling on Hpux 11.0 ?

Dennis,

Thanks for the on topic reply.

1) -p was used because it is advertised to produce, and used to, a nice simple
accounting of execution times and call counts. That's all that I need.

2) I thought that the archive library is the one that doesn't use shl_xxx. Are
you saying that network functions linked from libp/libc.a need shared
libraries? Can I pay extra to not get shared libraries?

3) 'will fail' means just that. The functions inet_addr() and gethostbyname()
are supposed to return -1 for malformed requests. In the case where -ldld is
linked to force resolution of shl_load etc., they return -1 for wellformed,
malformed, and anyformed requests.


Thanks very much for your help. Am I correct in concluding that programs using
Tcp/Ip socket networking and/or programs using setlocale, such as X windows,
cannot be profiled with call counts using -p or -G and prof/gprof ?


Kosaya




Dennis Handly wrote:
> KosayaFarrago@aol.com wrote:
>
>> If a 'cc' to compile and link is run with the -p option, the link
>> fails with the symbols shl_load and shl_unload undefined.
>>
>> It does not help to force archive linking with the -Wl,-a,archive
>> argument. This does link all .a libraries but some of them reference
>> the shared library routines as well. (Seems strange???)
>>
>> Forcing the dynamic loader to link using -ldld does resolve the
>> undefined symbols but then networking routines such as
>> 'gethostbyname()' and 'inet_addr()' will fail.

>
>
> (Why would you ever want to use -p instead of -G?)
>
> The short answer is you can't use -p/-G if you need to have those
> networking functions or setlocale that use shl_load.
>
> Using -p/-G links in an archive version of libc, /usr/lib/libp/libc.a.
> The last time someone asked about this, there were two types of sockets
> being used and that wasn't possible.
>
> When you say "will fail" above, what did you mean?
>

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 01-17-2008, 06:51 AM
Dennis Handly
 
Posts: n/a
Default Re: How does one link for profiling on Hpux 11.0 ?

KosayaFarrago@aol.com wrote:
> 1) -p was used because it is advertised to produce, and used to, a nice
> simple accounting of execution times and call counts. That's all that I
> need.


And you don't want the callers?

> 2) I thought that the archive library is the one that doesn't use
> shl_xxx. Are you saying that network functions linked from libp/libc.a
> need shared libraries? Can I pay extra to not get shared libraries?


Yes. Yes. No, networking uses dynamic loading. gethostent(3N) says:
WARNINGS
Programs that use the interfaces described in this manpage cannot be
linked statically because the implementations of these functions
employ dynamic loading and linking of shared objects at run time.


> Am I correct in concluding that programs
> using Tcp/Ip socket networking


See man page fragment above.

> and/or programs using setlocale, such as
> X windows, cannot be profiled with call counts using -p or -G and
> prof/gprof?
> Kosaya


Yes but you can always stub out setlocale.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:57 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com