CC and lazyload
807575Dec 30 2007 — edited Dec 31 2007Hello,
I am running into a problem using CC compiler, specifically to do with lazy-loading of shared libs.
I am trying to use the -zlazyload and -znolazyload options for ld.
Using the -V option of CC - the version is
CC: WorkShop Compilers 5.0 01/08/15 C++ 5.0 Patch 107311-14
My CC command looks like
CC -V -o simple simple.o -L. -zlazyload -ltestA -znolazyload -ldl
Would like to indicate that libtestA.so is to be lazy-loaded.
Using this compiler driver, if I display the ld link line it looks like (from -dryrun)
/usr/ccs/bin/ld -u __1cH__CimplKcplus_init6F_v_ -zlazyload -znolazyload -L. -R/u2/SUNWspro/lib/rw7:/u2/SUNWspro/lib:/usr/ccs/lib:/usr/lib:/opt/SUNWspro/lib -o simple /u2/SUNWspro/SC5.0/lib/crti.o /u2/SUNWspro/SC5.0/lib/crt1.o /u2/SUNWspro/SC5.0/lib/values-xa.o -Y P,/u2/SUNWspro/lib/rw7:/u2/SUNWspro/lib:/u2/SUNWspro/SC5.0/lib/rw7:/u2/SUNWspro/SC5.0/lib:/usr/ccs/lib:/usr/lib simple.o -ltestA -ldl -lCstd -lCrun -lC_mtstubs -lm -lw -lcx -lc /u2/SUNWspro/SC5.0/lib/crtn.o >&/tmp/ld.09687.0.err
I also get the warnings -
CC: Warning: Option -zlazyload passed to ld, if ld is invoked, ignored otherwise
CC: Warning: Option -znolazyload passed to ld, if ld is invoked, ignored otherwise
If I manually run this ld line changing around the zlazyload to be around -ltestA, then the lazy load works as expected.
At the end of all this, it looks like the lazyload flag is not being passed through to ld properly and as expected the lazyload does not work.
IF, I change over the compiler to
CC: Sun C++ 5.7 Patch 117830-02 2005/03/30
This time I now see the ld line is more appropriate and there are no warnings.
/usr/ccs/bin/ld -u __1cH__CimplKcplus_init6F_v_ -zld32=-S/tmp/lib_base_link.19595/libldstab_ws.so -zld64=-S/tmp/lib_base_link.19595/v9/libldstab_ws.so -zld32=-S/tmp/lib_base_link.19595/libCCexcept.so.1 -zld64=-S/tmp/lib_base_link.19595/v9/libCCexcept.so.1 -R/SUNWspro_5_7/lib/rw7:/SUNWspro_5_7/lib/v8plus:/SUNWspro_5_7/lib:/opt/SUNWspro/lib/v8plus:/opt/SUNWspro/lib:/usr/ccs/lib:/lib:/usr/lib -o simple /SUNWspro_5_7/prod/lib/crti.o /SUNWspro_5_7/prod/lib/CCrti.o /SUNWspro_5_7/prod/lib/crt1.o /SUNWspro_5_7/prod/lib/misalign.o /SUNWspro_5_7/prod/lib/values-xa.o -Y P,/SUNWspro_5_7/lib/rw7:/SUNWspro_5_7/lib/v8plus:/SUNWspro_5_7/prod/lib/rw7:/SUNWspro_5_7/prod/lib/v8plus:/SUNWspro_5_7/lib:/SUNWspro_5_7/prod/lib:/usr/ccs/lib:/lib:/usr/lib simple.o -L. -zlazyload -ltestA -znolazyload -ldl -lCstd -lCrun -lm -lc /SUNWspro_5_7/prod/lib/CCrtn.o /SUNWspro_5_7/prod/lib/crtn.o >&/tmp/ld.19595.0.err
Is this a known issue with CC WorkShop Compilers 5.0 01/08/15 C++ 5.0 Patch 107311-14
? If so is there a specific patch that rectifies this problem ? Or ?
Thanks.