Link Error: GCC 4.2.0 on SunOS-5.8

HEGDE, ASHA (ASHA) asha.hegde@alcatel-lucent.com
Mon Feb 7 09:55:00 GMT 2011


Hi Ian,

I have resolved this problem. My build script was using the std. GCC assembler and Solaris linker. Modifying the make file to use the Solaris assembler and linker fixed my relocation problem.

Thanks for your inputs.

Regards,
Asha

-----Original Message-----
From: Ian Lance Taylor [mailto:iant@google.com] 
Sent: Friday, February 04, 2011 9:55 PM
To: HEGDE, ASHA (ASHA)
Cc: gcc-help@gcc.gnu.org
Subject: Re: Link Error: GCC 4.2.0 on SunOS-5.8

"HEGDE, ASHA (ASHA)" <asha.hegde@alcatel-lucent.com> writes:

> Final link of ecemcectl.vx ...
>         /vobs/gnu/gcc/SunOS-5.8/bin/g++ cectl_dummy.o newmain.o tmp/__ecemcectl_vx_what.o /vobs/ecem_ucu/make/lib/ecectl/solaris/libecectl_appl.o /vobs/ecem_common/make/lib/ecectl/solaris/libcectl_common.o /vobs/ecem_common_oam/ucu/mhuapp/ecectl/solaris/mhuapp.o /vobs/ecem_rtcx/make/lib/ecectl/solaris/libcectl_rtcx.o /vobs/ecem_1bts/build/usl/pub/lib/ecectl/ram/solaris/usl_ecectl_ram_tgt.a /vobs/ecem_1bts/build/vxWorks4Host/solaris/libvxWorks4SunOS.a -v -uuslAppMain  -uusl_menu  -Wl,-R -Wl,/vobs/gnu/gcc/SunOS-5.8/lib -Wl,-R -Wl,/vobs/ecem_gnulibs/tclreadline/SunOS-5.8/lib -Wl,-R -Wl,/vobs/ecem_gnulibs/readline/SunOS-5.8/lib -W -L -Wl /vobs/ecem_gnulibs/zlib/SunOS-5.8/lib/libz_z.a -X -lnsl -lsocket -lposix4 -lthread -ldl   -o ecemcectl.vx
> Using built-in specs.
> g++: unrecognized option '-X'

g++ does not have a -X option.  I don't know where the problem is here,
but it doesn't seem to be with g++.  The linker does have a -X option;
perhaps this is intended by -Wl,-X?  But the linker's -X option is
rarely used.

> ld: warning: relocation error: file /vobs/ecem_ucu/make/lib/ecectl/solaris/libecectl_appl.o: section .rela.stab: skipping null relocation record

This seems very strange.  You appear to be using the Solaris linker, and
I assume you are also using the Solaris assembler.  The compiler does
not create relocation records; the assembler does.  I do not know why
the Solaris assembler would create an object file that the Solaris
linker complains about.

> ld: fatal: relocation error: R_SPARC_UA32: file .rela.eh_frame: section: /vobs/ecem_ucu/make/lib/ecectl/solaris/libecectl_appl.o: offset: 0x320: relocation requires reference symbol

This one, on the other hand, could be gcc's fault, or it could be the
assembler's fault.  You're going to need to look at that .o file and how
it was created to find out what is wrong.

Ian



More information about the Gcc-help mailing list