Operating System - HP-UX
1834058 Members
2485 Online
110063 Solutions
New Discussion

Link time error for +z/+Z

 
Anand_56
Occasional Advisor

Link time error for +z/+Z

When I build my library I get the error

/opt/aCC/lbin/ld: Invalid loader fixup in text space needed in output file for symbol "$00000091" in input file: "/usr/lib/libpthread.a(extension.o)". Make sure it was compiled with +z/+Z.

Can anyone tell me how to resolve this ?

Regards
Anand.
7 REPLIES 7
Simon Hargrave
Honored Contributor

Re: Link time error for +z/+Z

Have you tried actually doing what the error message tells you to do? ie use the +z or +Z option on your cc line?

From the cc(1) man page:

+z,+Z Both of these options cause the compiler to generate
position independent code (PIC) for use in building
shared libraries. +Z is the default in 64-bit mode.
The -G and -p options are ignored if +z or +Z is used.
Normally, +z should be used to generate PIC; however,
when certain limits are exceeded, +Z is required to
generate PIC. The ld linker issues the error
indicating when +Z is required. If both +z and +Z are
specified, only the last one encountered applies.
Amit Agarwal_1
Trusted Contributor

Re: Link time error for +z/+Z

There is not one reason why you would get this error, but many probable reasons.
1) Your code was not compiled with +z/+Z option, so ensure that you use these option while creatign object files.
2) Last but not the least, if you are compiling with +03 option, try compiling with +02.
3) You are using const for pointers, which will be exported and be visible outside library. Remove the const qualifier
4) You are using static pointers that get assigned some address at runtime. you might need to remove static.

Try taking one solution at a time, and perform compile and linking. If it works then fine, else try the other one in the same order as above.

HTH
-Amit
Anand_56
Occasional Advisor

Re: Link time error for +z/+Z

Hi,
I am already using +z to compile my shared lib.

I also tried removing 'const' from my pointers and I am not using any static pointers.

Is it possible that one of the libs I am linking to, is not built with +z ?

Regards
Anand.


Amit Agarwal_1
Trusted Contributor

Re: Link time error for +z/+Z

The error shows that extension.o in libpthread.a is not compiled with +z/+Z. That's right becaues objects of archive library need not be compiled with that options.

Is there any specific reason that you are linking with libpthread.a? Why not .sl?

Try '-a shared_archive' on the link line.
Anand_56
Occasional Advisor

Re: Link time error for +z/+Z

Amit,
My makefile currently has +z. When I used '-a shared_archive' I get several errors 'use +Z option to recompile'. But just compiling that library with +Z does not seem to help. It seems that I have to compile my whole source with +Z.
Because when I compiled that library with +Z i got errors 'Data Linkage Table (+z) overflow in file ../../../libs/HP-UX/libacmcrypt.a(strng.o)' where libacmcrypt.a is one more of my application libraries.

So does this mean that I have to rebuild my whole application with +Z ?
H.Merijn Brand (procura
Honored Contributor

Re: Link time error for +z/+Z

Yes. That's what it means. And while you're at it, also add -z

FWIW removing 'const' keywords is a wrong idea. You might miss out on a number of compiler optimizations. 'const' has nothing to do with +Z. +Z deals with relocatable code. const has to deal with non-changing data

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Anand_56
Occasional Advisor

Re: Link time error for +z/+Z

So does it mean that my makefiles for 32-bit will not work on 64-bit ?

I ask this because I have been using the same makefiles to compile code that uses Oracle 32 bit. Only when I am using Oracle 64-bit that I am facing this problem ?

I am confused..

Anand.