1832785 Members
3392 Online
110045 Solutions
New Discussion

DP relative code in file

 
Jianhua Zhou
New Member

DP relative code in file

We try to link a program on HP and get the error message like that:
$CC -b -o uvtest.sl uvtest.o -L/var/uv/lib -lvm_ici

/usr/ccs/bin/ld: DP relative code in file
/var/uv/lib/libvm_ici.a(ic_info.o) - shared library must be position independent. Use +z or +Z to recompile.

What is this means?

Is this means the library libvm_ici.a has some code be compiled without -z options?
Is this means if we link the a shared library, all the object must compiled with -z option?

Thanks!
2 REPLIES 2
Carlos Fernandez Riera
Honored Contributor

Re: DP relative code in file


From man cc:

+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. For
a more complete discussion regarding PIC and these
options, see HP-UX Linker and Libraries Online User's
Guide and the manual Programming on HP-UX.
unsupported
Steven Gillard_2
Honored Contributor

Re: DP relative code in file

The vm_ici library you are linking with has not been compiled as PIC (with +z), so you cannot use it in a shared library. If you have this libraries source code, simply recompile with +z, otherwise you will have to contact the vendor for a shared version.

Regards,
Steve