Unix Technical Forum

Prevent linking of crt0.o

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


Go Back   Unix Technical Forum > Unix Operating Systems > HP-UX Operating System

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-16-2008, 08:59 PM
Anunay
 
Posts: n/a
Default Prevent linking of crt0.o

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-16-2008, 08:59 PM
Vishwas Pai
 
Posts: n/a
Default Re: Prevent linking of crt0.o

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-16-2008, 08:59 PM
Anunay
 
Posts: n/a
Default Re: Prevent linking of crt0.o

vishwas wrote:-
> You should be linking with /opt/langtools/lib/scrt0.o
> while creating shared library.


So, how do i get rid of that "position independent" error?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-16-2008, 08:59 PM
Paul Pluzhnikov
 
Posts: n/a
Default Re: Prevent linking of crt0.o

"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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-16-2008, 09:00 PM
Marty Freitas
 
Posts: n/a
Default Re: Prevent linking of crt0.o

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 01-16-2008, 09:00 PM
Anunay
 
Posts: n/a
Default Re: Prevent linking of crt0.o

Marty Freitas wrote:-
> Yes, PHSS_21505 doesn't understand -b and using -Wl,-b just confuses the
> linker and cc.


Which patch should I install to update the compiler?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 01-16-2008, 09:00 PM
Marty Freitas
 
Posts: n/a
Default Re: Prevent linking of crt0.o

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:24 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com