GCC 2.95.1 and HP-UX 10.20 and shared libraries

Jeffrey A Law lawATcygnus.com
Wed Sep 15 17:16:00 GMT 1999


  In message < 14303.63227.832085.101012@eel.compgen.com >you write:
  > 
  > Hello,
  > 
  > I've been having a frustrating time with compiling a shared library
  > with GCC 2.7.2.3.  I got an error from the linker as follows:
  > 
  > /usr/local/lib/gcc-lib/hppa1.0-hp-hpux10.20/2.7.2.3/ld: Target of unconditi
  > onal branch is out of range
  >    Reference from:  /obj/dcs/dcs/obj/dcs_dportal_filename.o(0x3ff7c)
Update to a newer version of gcc.  Newer versions are much better about 
handling
out of range branches/calls.

  > When I try to create a shared library, I get an error from the linker:
  > 
  > /usr/ccs/bin/ld: DP relative code in file /var/tmp/cciKnbLv.o - shared libr
  > ary must be position
  >     independent.  Use +z or +Z to recompile.
  > 
  > I AM compiling with -fPIC as a command line flag.  I configured
  > gcc-2.95.1 as follows: 
But I bet you're not using it on the line to create the shared library.
Creation of a shared library also involves compiling code on some targets
(such as the PA).  You need to ensure that code is PIC too.

-mshared-libs/-mno-shared-libs were very very old options and are no longer
necessary.  gcc has been able to correctly produce shared libraries on hpux for
about 6 years now.

jeff



More information about the Gcc-bugs mailing list