How does one link for profiling on Hpux 11.0 ? - HP UX

This is a discussion on How does one link for profiling on Hpux 11.0 ? - HP UX ; 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 ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: How does one link for profiling on Hpux 11.0 ?

  1. 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

  2. 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...

  3. Re: How does one link for profiling on Hpux 11.0 ?

    Rick Jones 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...

  4. 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?


  5. 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?
    >


  6. 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.


+ Reply to Thread