aCC option to load all the symbols during linking - HP UX

This is a discussion on aCC option to load all the symbols during linking - HP UX ; Hi, Is there any option for aCC compiler to load all the symbols during linking (with +O2 option enable)? When I create an executable with +O2 option, it is not loading all the functions into the executable (Not loading functions ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: aCC option to load all the symbols during linking

  1. aCC option to load all the symbols during linking

    Hi,
    Is there any option for aCC compiler to load all the symbols during
    linking (with +O2 option enable)?

    When I create an executable with +O2 option, it is not loading all the
    functions into the executable (Not loading functions that are not
    called in the execution).

    But I want to have all the functions(symbols) loaded during the
    creation of the executable.

    Thanks,
    Bujji


  2. Re: aCC option to load all the symbols during linking

    "Bujji" writes:

    > Is there any option for aCC compiler to load all the symbols during
    > linking (with +O2 option enable)?


    No: aCC doesn't *do* linking; the system linker does that.

    > When I create an executable with +O2 option, it is not loading all the
    > functions into the executable (Not loading functions that are not
    > called in the execution).


    Presumably you are linking with archive libraries, and you want
    the equivalent of the GNU-ld --whole-archive ...

    AFAICT, there is no matching HP ld flag.

    One way to achive that is to list all symbols you want to be included
    in the link with '-u sym1 -u sym2 ...'

    Another option is to "blow up" the archive:

    mkdir tmp.$$ && cd tmp.$$ &&
    ar x /path/to/archive.a &&
    cd .. && aCC -o foo.exe main.o tmp.$$/*.o &&
    rm -rf tmp.$$

    Cheers,
    --
    In order to understand recursion you must first understand recursion.
    Remove /-nsp/ for email.

  3. Re: aCC option to load all the symbols during linking

    Paul Pluzhnikov wrote:
    : AFAICT, there is no matching HP ld flag.

    There is +[no]forceload for IPF and PA64. And -Fl for PA32.

    : ... included in the link with '-u sym1 -u sym2 ...'
    : Another option is to "blow up" the archive:

    Yes.

    "Bujji" got some answers in CXX-DEV.
    http://h21007.www2.hp.com/dspp/comm/...,1273,,00.html

+ Reply to Thread