This is a discussion on Prevent linking of crt0.o within the HP-UX Operating System forums, part of the Unix Operating Systems category; --> Hello all, I am trying to build a shared library. The compiler driver invokes the linker and the linker ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 |
| |||
| Anunay wrote: > /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. > You should be linking with /opt/langtools/lib/scrt0.o while creating shared library. --vishwas |
| |||
| "Anunay" <anunaygupta@gmail.com> writes: > I am trying to build a shared library. The compiler driver invokes the > linker and the linker string looks as below:- > > Compiler: HP92453-01 A.11.01.21505.GP (Native compiler) Your compiler is too old, and doesn't understand '-b' flag. This is one (rare) case where you have to bypass the compiler driver and link your shared library directly with 'ld'. Cheers, -- In order to understand recursion you must first understand recursion. Remove /-nsp/ for email. |
| |||
| Paul Pluzhnikov wrote: : "Anunay" <anunaygupta@gmail.com> writes: : > I am trying to build a shared library. : > Compiler: HP92453-01 A.11.01.21505.GP (Native compiler) : Your compiler is too old, and doesn't understand '-b' flag. : This is one (rare) case where you have to bypass the compiler driver : and link your shared library directly with 'ld'. Yes, PHSS_21505 doesn't understand -b and using -Wl,-b just confuses the linker and cc. |
| ||||
| Anunay wrote: : Which patch should I install to update the compiler? You can't. The last patch for that version of the compiler is PHSS_25171 and that still doesn't support -b. You must purchase a new compiler. Or if you have a compiler support contract you can get the latest update: http://www.hp.com/go/c http://h21007.www2.hp.com/dspp/tech/...1,1255,00.html |