Operating System - HP-UX
1846594 Members
1214 Online
110256 Solutions
New Discussion

Re: Avoid specifying the entry point

 
guptaanunay
Occasional Contributor

Avoid specifying the entry point

Hello all,

I am trying to build a shared library. The compiler driver invokes the linker and the linker string looks as below:-

/usr/ccs/bin/ld /opt/langtools/lib/crt0.o -u main -b -B symbolic +vnocompatwarnings -z +s +h libxxx.sl -o libxxx.sl -Fl libyyy.a -L. +s -ldld –lc

And, I get the following error:-
/usr/ccs/bin/ld: DP relative code in file /opt/langtools/lib/crt0.o - shared library must be position independent. Use +z or +Z to recompile.

The object files in the archive libyyy.a are all built in PIC mode. AFAIK, we can't change the startup file crt0.o, so is there a way out?

Secondly, what I feel is that crt0.o should not be linked while building a shared library. It is exclusively for building executables. I am unable to figure out from where is this crt0.o is getting linked. Is it because of the usage of "-u main" option?

Machine specifics:-
HP-UX 11.00 PA-RISC 2.0
Compiler: HP92453-01 A.11.01.21505.GP (Native compiler)

Kindly suggest.
Thanks,
Anunay
1 REPLY 1
Dennis Handly
Acclaimed Contributor

Re: Avoid specifying the entry point

What does the cc(1) command line look like?
It appears you used "-Wl,-b", instead of just -b.

>we can't change the startup file crt0.o, so is there a way out?
>what I feel is that crt0.o should not be linked while building a shared library.

Yes, let cc(1) know you don't want it with -b.