This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: GCC 2.95.1 and HP-UX 10.20 and shared libraries
- To: Eric dot Ayers at compgen dot com
- Subject: Re: GCC 2.95.1 and HP-UX 10.20 and shared libraries
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Wed, 15 Sep 1999 18:12:29 -0600
- cc: gcc-bugs at gcc dot gnu dot org
- Reply-To: law at cygnus dot com
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