[comp.unix.ultrix] Problems with CC on DECStation 3100

mking@lll-crg.llnl.gov (Marianne King) (09/21/90)

	We have some code that runs on Sun 3s and 4s.  I'm trying to get
the code running on a DECStation 3100(mips) running Ultrix 4.0.
The modules compile but I am getting errors during the load dealing
with gp relocation problems.  I have the output from the make listed
below.  I would like some hints on where I can look to solve the problem.

Thanks in advance.

cc -o rec_llnl.mips.o -O -c recon.c -DLLNL
f77 -o fft842.mips.o -c -O fft842.f
cc -o rho_prim.mips.o -O -c rho_prim.c
cc -o backproj_prim.mips.o -O -c backproj_prim.c
cc -o fbp_prim.mips.o -O -c fbp_prim.c
cc -o wart.mips.o -O -c wart.c
cc -o main.mips.o -O -c main.c
cc -o ascii_file.mips.o -O -c ascii_file.c
cc -o binary_file.mips.o -O -c binary_file.c
cc -o ctp_file.mips.o -O -c ctp_file.c
cc -o disp_funcs.mips.o -O -c disp_funcs.c
cc -o other_file.mips.o -O -c other_file.c
cc -o parse_args.mips.o -O -c parse_args.c
cc -o timing.mips.o -O -c timing.c
cc -o view_file.mips.o -O -c view_file.c
cc -o center.mips.o -O -c center.c
f77 -o rec_llnl_mips -O rec_llnl.mips.o fft842.mips.o rho_prim.mips.o  	backproj_prim.mips.o fbp_prim.mips.o wart.mips.o main.mips.o ascii_file.mips.o binary_file.mips.o ctp_file.mips.o disp_funcs.mips.o  other_file.mips.o parse_args.mips.o timing.mips.o view_file.mips.o center.mips.o  	-lF77 -lI77 -lU77 -lm
xdisp: both a large and small symbol (possible gp relocation errors may result)
ld:
rec_llnl.mips.o: gp relocation out-of-range in .text section for relocation entry 214 for symbol: xdisp
rec_llnl.mips.o: above gp relocation entry for non .sdata or .sbss symbol
rec_llnl.mips.o: gp relocation out-of-range in .text section for relocation entry 245 for symbol: xdisp
rec_llnl.mips.o: above gp relocation entry for non .sdata or .sbss symbol
All data will fit into the global pointer area
Best -G num value to compile all -count'ed objects
creating rec_llnl_mips with is 4800 (or greater)
Best -G num value calculation reliable only if all
-count'ed objects were compiled with -G num greater or
equal to maximum size of a literal pool item (8).
*** Error code 1

==========================

Marianne E. King
mking@lll-crg.llnl.gov
(415) 423-4116

ylc@texhrc.UUCP (Yin L. Cheung) (09/22/90)

I've seen the "gp relocation" errors when external variables are
not declared and referenced consistently.  For example, when a variable is
declared as a structure and then externally referenced as a pointer to
structure.  "Lint" should uncover the inconsistency.  Below is an example
that generates "gp relocation" errors:

h1.h:
	typedef struct {
	    int len;
	    char data[256];
	} CountedString; 
c1.c:
	#include <stdio.h>
	#include "h1.h"
	CountedString cs = {5, "abcde"};
	func(ccs)
	    CountedString *ccs;
	{
	    int i;
	    for (i=0; i < ccs->len; i++) fputc(ccs->data[i], stdout);
	}
c2.c:
	#include "h1.h"
	extern CountedString *cs;
	main() {
	    func(&cs);
	}

Note that "cs" is declared inconsistently across c1.c and c2.c.  This
example will not link on the DS3100, but for reasons I don't understand
will link and run on a SPARCstation.

=======================
Yin Cheung, Texaco Inc.
convex!texhrc!ylc
=======================