[comp.sys.mips] ld error msg

gargulak@convex.com (Tom Gargulak) (08/23/90)

I am getting the following error message when I use the MIPS link editor (ld).

(name.o): R_GPREL relocation entry with no global pointer reference

The source which is being compiled is C.  I noticed that it happens to
files that have string constants (i.e. "my string").  If I edit the .s
file after compiling with -S and change the .sdata section containing the 
string to .data the ld error goes away.

Any Ideas?

What does this error message mean?

Thanks,
Tom

len@mips.COM (Len Lattanzi) (08/24/90)

In article <gargulak.651424524@convex> gargulak@convex.com (Tom Gargulak) writes:
:I am getting the following error message when I use the MIPS link editor (ld).
:
:(name.o): R_GPREL relocation entry with no global pointer reference
:
It means that you are attempting a full link (generate executable)
without using the standard crt startup routines like /lib/crt1.o which
initialize the global pointer register. Assuming you're using ld
rather than cc because you have a cross target environment in mind you
should be able to work around this by either adding the assembly line
	la gp,_GP
to your entry point code or compile everything -G 0

-- 
\
 Len Lattanzi	({ames,pyramid,decwrl}!mips!len) <len@mips.com>
 I would have put a disclaimer here but I already posted the article.